Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Antechinus in Januar 17, 2015, 03:23:14 NACHMITTAGS

Titel: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Beitrag von: Antechinus in Januar 17, 2015, 03:23:14 NACHMITTAGS
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) Auswählen
<img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />

Code (Replace) Auswählen
<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) Auswählen
', !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) Auswählen
', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '


Titel: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Beitrag von: kat in Januar 17, 2015, 04:29:41 NACHMITTAGS
/me 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... :)
Titel: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Beitrag von: Antechinus in Januar 17, 2015, 04:33:50 NACHMITTAGS
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.
Titel: Re: [TIP] Call core features icon by theme (fix for 2.0.x bug)
Beitrag von: kat in Januar 17, 2015, 04:53:51 NACHMITTAGS
Zitat von: Antechinus in Januar 17, 2015, 04:33:50 NACHMITTAGS
Oh bother.

That was a bit refined, for you! ;)

Ta, Ant!