Back to Programming Articles

Setting smilie alignment in posts
by Tungsten 25 Apr 2002

Something that had been bugging me for a while now was the fact that VBulletin didn't declare an alignment option for the "img src" tags used for smilies inserted into posts.

Why did this bug me?

Because some smilies cause the paragraph line spacing in a post to be fairly skewed, especially if the smilie is larger than 15x15 pixels. I tend to think that it looks better if the alignment is set to "absmiddle" in the IMG tag.

To change the default behavior, you need only edit one file and make one change.

Open the functions.php file in your VBulletin admin directory and do the following...

find this in the admin\functions.php file
PHP Code:
        $bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\">",$bbcode); 
and replace it with this
PHP Code:
        $bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"$smilie[smiliepath]\" border=\"0\" align=\"absmiddle\" alt=\"\">",$bbcode); 

Note the addition of the align=\"absmiddle\" in the img src tag. This will force the smilie to be aligned so that it's center is equal to the center of the line of text that surrounds it.

You could change the alignment value to any of the other viable HTML 4.0 options for the "img" tag. For more information on the alignment options available, visit this page:

http://www.htmlhelp.com/reference/html40/special/img.html

Hope this helps someone else!

Similar Mods

Smilie Info: Smilie Usage in Posts vBulletin 3.6 Add-ons
[HTL] & [Normal] Setting Varname Next to the Setting Title. vBulletin 3.0 Full Releases

vblts.ru supports vBulletin®, 2022-2024