News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[TIP] Call core features icon by theme (fix for 2.0.x bug)

Started by Antechinus, January 17, 2015, 03:23:14 PM

Previous topic - Next topic

Antechinus

Most people probably won't worry about this, but 2.0.x has a bug (another one :D) in that although all 2.0.x themes include icons for the core features page, no theme will ever use them. This is because some bright spark (dunno who) coded Admin.template.php so that it will always call those icons from the default theme.*

If you've been wondering why you can't get custom icons on that page, now you know.

The fix is easy. Admin.template.php:

Code (Find) Select
<img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

Code (Replace) Select
<img class="features_image png_fix" src="', $settings['images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

I'm using this to load a custom set with lower opacity for a dark theme. Knocks the edge off the eye-burning glow. ;)


*Incidentally, this means every custom theme on the theme site has superfluous images in it.

ETA: Oh yeah, just checked and the same dopey code is in the part for the quick tasks icons too. To fix that:

Code (Find) Select
', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['default_images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '


Code (Replace) Select
', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '



kat

* K@ wonders why he doesn't have that line of code in his file...

Something similar, though...

<img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

**scratches head**

Maybe some mod played with it, ay?

I assume I change that to:

<img class="features_image png_fix" src="', $settings['images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

Well, nothing broke, at least... :)

Antechinus

#2
Oh bother. I was taking that from a custom template. Will edit OP to have the (equally silly) default code. :D

ETA: Done.

You can also remove the png_fix class, incidentally, since that is dinosaur code for old versions of IE.


Advertisement: