News:

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

Main Menu

2.1 RC2 Changing Board Icons

Started by Dominus Arbitrationis, July 03, 2019, 12:18:21 PM

Previous topic - Next topic

Dominus Arbitrationis

Hi,

Is it possible to set the board icons to a custom icon for each board? My current 2.0.15 forum has this set up (Not on a default theme, however), but the 2.1 rc2 test forum doesn't appear to have this functionality.

Kindred

if 2.0.x has it, you did it by a mod -- this is not a standard feature in any version of SMF.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Dominus Arbitrationis

Quote from: Sir Osis of Liver on July 03, 2019, 12:35:31 PM
You can try this mod -

https://custom.simplemachines.org/mods/index.php?mod=4224


I like that mod, but it doesn't appear to support custom images. Am I just missing something there?

Kindred

You do realize that you apply custom images by CSS alone?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Dominus Arbitrationis

Yes. I was just hoping there would be a better system for it, like if there were an option when modifying boards to change the image to any you select. That way, people who don't know/can't be bothered to learn CSS can edit the images.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Bigguy

No it doesn't. I have been trying to update it but at the present moment I have had no luck.

Diego Andrés

For the default theme you could do something like this:

Code (BoardIndex.template.php (Search)) Select
// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';


Code (Replace) Select
// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url']. '/boardicons/', $board['id'],'.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url']. '/boardicons/', $board['id'],'.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url']. '/boardicons/', $board['id'],'.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';


Then add a new folder boardicons in Themes/{yourtheme}/images
And you add an image for each board by id. E.g. ?board=1.0, 1 is that forum ID so you save your icon as 1.png
Also could change this to your preference

// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url']. '/boardicons/', $board['id'],'.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';


Like using
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url']. '/boardicons/', $board['id'],'_off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';

So you can have 1_off.png for the off icon, or simply add an inline style for opacity

Regards

SMF Tricks - Free & Premium Responsive Themes for SMF.

Bigguy

If that code is for 2.1, you pretty much just updated the cbi mod, lol.

Diego Andrés

That was for 2.0 I didn't read the title tbh
But it's pretty much the same just add your icon instead of using css

function template_bi_board_icon($board)
{
global $context, $scripturl;

echo '
<a href="', ($context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a>';
}

SMF Tricks - Free & Premium Responsive Themes for SMF.

Advertisement: