XF 1.5 Change clear.png reference to absolute url?

alex2k5

Member
Looks like the clear.png file that overlays smilies and the like are hardcoded relative.

I am using a custom add on that shows forum content on pages outside the main forum directory. So, that image comes back not loaded and 404 not found on all those pages.

Is there any way to change that location easily that I'm not seeing? If not, a file edit, which one, etc?

Example:

Code:
<img src="styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie10" alt=":oops:" title="Oops!    :oops:" />

Code:
<img src="http://www.domain.com/forum/styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie10" alt=":oops:" title="Oops!    :oops:" />

Thanks!
 
To do this properly would require a proper add-on to be created, but there is a shortcut simply if you edit the file library/XenForo/BbCode/Formatter/Base.php:

PHP:
protected $_smilieSpriteTemplate = '<img src="styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie%1$d" alt="%2$s" title="%3$s    %2$s" />';
 
Actually, I wrote an add-on a few years ago to add a space after each smilie - it just involved editing the two smilie templates in this file and adding a space, but it does so as a proper add-on:

https://xenforo.com/community/resources/space-after-smilie.1558/

It's a very simple add-on so if you were interested in doing this "properly" then this would be a good place to start.
 
Actually, I wrote an add-on a few years ago to add a space after each smilie - it just involved editing the two smilie templates in this file and adding a space, but it does so as a proper add-on:

https://xenforo.com/community/resources/space-after-smilie.1558/

It's a very simple add-on so if you were interested in doing this "properly" then this would be a good place to start.

That did it. Left the space functionality in there too :)

I hard coded, but, is there a way to utilize the options forum path in there so it can be ported to other installs easier in the future?
 
Just using the original XF code as an example:

PHP:
protected $_smilieSpriteTemplate = '<img src="' . XenForo_Application::getOptions->boardUrl . '/styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie%1$d" alt="%2$s" title="%3$s    %2$s" />';

That's probably the easiest way.
 
To do this properly would require a proper add-on to be created, but there is a shortcut simply if you edit the file library/XenForo/BbCode/Formatter/Base.php:

PHP:
protected $_smilieSpriteTemplate = '<img src="styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie%1$d" alt="%2$s" title="%3$s    %2$s" />';
Hi Chris,
Sorry to bump an old thread but I've followed suit and they've still not updated with the correct path.
Any ideas if this still works as mentioned or is there also something else we need to do?
Thank you in advance. :)
 
Last edited:
Does anyone else have an idea or has done this successfully?

I adapted Chris D's addon below to do it.

Actually, I wrote an add-on a few years ago to add a space after each smilie - it just involved editing the two smilie templates in this file and adding a space, but it does so as a proper add-on:

https://xenforo.com/community/resources/space-after-smilie.1558/

It's a very simple add-on so if you were interested in doing this "properly" then this would be a good place to start.

Was very straightforward. Just edit the Base.php file from the addon (found at upload/library/SpaceAfterSmilie/BbBode/Formatter/Base.php). In my case, I wanted to use my CDN, so I changed

Code:
protected $_smilieSpriteTemplate = '<img src="styles/default/xenforo/clear.png"

to

Rich (BB code):
protected $_smilieSpriteTemplate = '<img src="https://cdn2.mu-43.com/styles/default/xenforo/clear.png"

I also changed

Rich (BB code):
protected $_smilieTemplate = '<img src="%1$s" class="mceSmilie" alt="%2$s" title="%3$s    %2$s" />&nbsp;';

to

Code:
protected $_smilieTemplate = '<img src="%1$s" class="mceSmilie" alt="%2$s" title="%3$s    %2$s" />';

since I didn't want the space after smilies.

Then I just installed the addon without any other changes, and it did the job (y).
 
Back
Top Bottom