Page 1 of 1
alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 14:01
by update
HI
I'm looking for a solution to pass some "Alt" text to this one:
Code: Select all
[ID home]{IMAGE:img/house.gif}[/ID]
Is it possible - if yes, how? Searching the forum hmm...
Passing along something like
Code: Select all
[ID home]{IMAGE:img/house.gif|nach hause telefonieren}[/ID]
shuts off the pic completely
Re: alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 15:26
by flip-flop
Hi claus,
For me it isn´t possible.

Please write your own TAG or make a patch in front.func.inc.php
Knut
Re: alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 15:42
by juergen
Ok, called it {A_IMAGE:pic_name:alt-and-titleText:id-or-alias}
put this in frontend_render as anyname.php
Code: Select all
<?php
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
$content["all"] = preg_replace('/\{A_IMAGE:(.*?):(.*?):(.*?)\}/ie', 'liste26("$1","$2","$3")', $content["all"]);
function liste26($bild,$alt,$ID) {
if (is_numeric($ID)) {
$lista='<a href="index.php?aid='.$ID.'" class="phpwcmsIntLink">';
}
else {
$lista='<a href="index.php?'.$ID.'" class="phpwcmsIntLink">';
}
$lista =$lista. '<img src="picture/'.$bild.'" alt ="'.$alt.'" title="'.$alt.'"> </a>';
return($lista);
}
?>
worked for me, tested in 1.3.x with rewrite on, should also do with off
have fun
Jürgen
Re: alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 21:05
by update
Thanks a lot!
Will give it a try...
Re: alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 21:12
by update
This is working like nothing
Only to adjust the img path and gone.. Thanks again
If the img cannot be found it still shows the title/alt text as a link.

Re: alt text for [ID X]{IMAGE:..... ?
Posted: Sun 30. Dec 2007, 21:49
by juergen
claus wrote:If the img cannot be found it still shows the title/alt text as a link.

this is only why I am to stupid to change the code that it likely draws some nice pictures if there is no material

Re: alt text for [ID X]{IMAGE:..... ?
Posted: Mon 31. Dec 2007, 11:15
by fopulu
Hi Claus,
maybe this could help you.... i had the same problem and fixed it in the front.func.inc.php
http://forum.phpwcms.org/viewtopic.php?p=95894#p95894
Have a look around line 1335:
Code: Select all
// internal Link to article ID
$search[1] = '/\[ID (\d+)\](.*?)\[\/ID\]/';
$replace[1] = '<a href="index.php?aid=$1" class="phpwcmsIntLink" title="$2">$2</a>';
The title or alt text is in this case the same as the link is called....
Re: alt text for [ID X]{IMAGE:..... ?
Posted: Mon 31. Dec 2007, 12:33
by update
Hi,
I've "enhanced" the anyname.php a little bit. Now the output is valid and some spaces are removed. Have a look
Code: Select all
<?php
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// call it like so: {A_IMAGE:pic_name:alt-and-titleText:id-or-alias}
// example: {A_IMAGE:house.gif:home:home}
//the script is now accessing the picture/img folder, so you have to change it accordingly to the correct path
$content["all"] = preg_replace('/\{A_IMAGE:(.*?):(.*?):(.*?)\}/ie', 'liste26("$1","$2","$3")', $content["all"]);
function liste26($bild,$alt,$ID) {
if (is_numeric($ID)) {
$lista='<a href="index.php?aid='.$ID.'" class="phpwcmsIntLink">';
}
else {
$lista='<a href="index.php?'.$ID.'" class="phpwcmsIntLink">';
}
$lista =$lista. '<img src="picture/img/'.$bild.'" alt="'.$alt.'" title="'.$alt.'" /></a>';
return($lista);
}
?>
This is working!
@fopulu
thank you -I checked your recommendation - this is working too:
Code: Select all
$replace[1] = '<a href="index.php?aid=$1" class="phpwcmsIntLink" title="$1">$2</a>';
and shows the number of the article (using $2 instead of $1 throws an error (v 135 071205) )
But as mentioned before somewhen: dealing with the source is always something which keeps at least me off to use this or that nice mod or addon (I've been starting with phpwcms doing it like this, added everything and became quite unhappy while doing my first update)
