Topic: Alt text for smilies

Not sure about this but it really annoys me imo the alt text should be the text that the user types to show the smilie otherwise when you disable images or paste posts you get stuff like tongue in the middle of it. Not sure if thats "incorrect" though

2

Re: Alt text for smilies

Logically I think it should be what the user typed because if you weren't using graphic smilies the viewer wouldn't get an explanation of what the text symbols meant so the alt text would have exactly the same degree of meaning and accessibility as the plain text symbols.

Re: Alt text for smilies

I kinda agree with this... It would make the posts much more readable, without images smile

It's easy enough to "fix", but I think it would be better with this as the default setting...

For those who wants this, just:

Open include/parser.php

Find, around line 402:

        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

Replace with:

        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" alt="'.$smiley_text[$i].'" />$2', $text);

Re: Alt text for smilies

Cool. Thanks CodeXP!

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Alt text for smilies

yeh i know its easy to fix but it should be default behaviour i guess, the only reason i want it is it annoys me when i paste text lol

Re: Alt text for smilies

I'm not sure, but I think I did it like this for a reason. Hmm.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7 (edited by bradleyb 2005-11-02 21:52)

Re: Alt text for smilies

another vote for the alt text to be $smilie_text[].
I'd much rather see

:)

than "smile" when I copy/paste something, or read it with lynx, or whatever.  It makes the behavior with "images off" in your browser be consistent with turning "smilies off" in punbb.

Maybe it's more appropriate to use the title attribute for the name of the smilie.