News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

A bug in Themes/default/Post.template.php ?

Started by –Michael, June 26, 2005, 11:56:28 AM

Previous topic - Next topic

–Michael

Hi,

Currently I try to optimize my theme which is based on the default theme. I deleted the MyTheme/images/bbc - folder, so SMF uses the default as fallback.
However, the blue background is not displayed anymore:


In addition, the grey background is not displayed anymore after I have navigated the mouse to such a button:


Solution:

In the Themes/default/Post.template.php, there is the following code (line # 606):

something.style.backgroundImage = "url(" + smf_images_url + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)");


Replace this with:

something.style.backgroundImage = "url("+"' . $settings['images_url'] . '" + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)");


What I've found out so far: the JavaScript variable smf_images_url contains the theme's image url, but if the image does not exist, it does not fallback to the image of the default theme. $settings['images_url'] does work.




My SMF version: v1.0.5. So I do not know if this will already be considered in 1.1.

Well, the JavaScript variable smf_images_url is used more than once in SMF, I suggest to replace it with $settings['images_url'].

Michael
My SMF Mod: Static Page Mod

[Unknown]

It doesn't check the existence of every image or even every directory before showing images, because that would be expensive (and brittle.)

-[Unknown]

–Michael

Hmm, as far as I could see, the $settings['images_url'] is set in dependence of where the php file is located.
This means if for example the Post.template.php is located in Themes/MYTHEME, the variable contains ...Themes/MYTHEME/images, but if Post.template.php is located in Themes/default, the variable contains ...Themes/default/images — but only if the image files in Themes/MYTHEME do not exist.

IMHO, this behavior is OK (also in consideration of performance), but I think $settings['images_url'] should always be used — so no exception for JavaScript routines.

Regards,
Michael
My SMF Mod: Static Page Mod

Advertisement: