MyBB Community Forums

Full Version: forum icons
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have a doubt.

I want to use custom icons for each of my forums, which I have already done and configured, but I want my subforums to be with the default icon, that is, those that are not main are default, I have seen this in a different forum and it is possible, What do I have to do to do this?

Forum categories
[Image: image.png]
Subforum
[Image: image.png]
forumbit_depth2_forum Open.

Find
<span class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"></span>

Replace
<img src="images/icons/forumicons_{$forum['fid']}.png" width="40" height="40" alt="{$forum['name']}" />

Example: images/icons/forumicons_7.png or images/icons/forumicons_33.png etc.
(2020-05-14, 11:02 PM)mybbturkce Wrote: [ -> ]forumbit_depth2_forum Open.

Find
<span class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"></span>

Replace
<img src="images/icons/forumicons_{$forum['fid']}.png" width="40" height="40" alt="{$forum['name']}" />

Example: images/icons/forumicons_7.png or images/icons/forumicons_33.png etc.

What I would like is that, my subforums, even if they don't have an image, look for the default image, since if I wouldn't have to put in my folder an image for each subforum and forum, I would like to put one by default if it doesn't get the id added, is this possible? Here my forumbit_depth2_forum


<!-- <i class="fa fa-comments"></i></div></td>  <> <> -->
<tr>
<td class="{$bgcolor}" align="center" width="1"><div class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}">
<img src="images/iconforo/{$forum['fid']}.png" width="50" height="50" alt="{$forum['name']}" />
<td class="{$bgcolor}">

<strong><a href="{$forum_url}">{$forum['name']}</a></strong>{$forum_viewers_text}<div class="smalltext">{$forum['description']}{$modlist}{$subforums}</div>
</td>
<td id="threads" class="{$bgcolor}" align="center" style="font-size: 15px;white-space: nowrap">{$threads}{$unapproved['unapproved_threads']}</td>
<td id="replies" class="{$bgcolor}" align="center" style="font-size: 15px;white-space: nowrap">{$posts}{$unapproved['unapproved_posts']}</td>
<td id="lastpost" class="{$bgcolor}" style="white-space: nowrap">{$lastpost}</td>
</tr>
No, it is not possible to play with filenames und chose a default file.
And it is not beneficial to run the browser into loading a file that does not exist. This will cause one or more useless HTTP requests end up in file not found.

In this case you are better off using CSS and background images.
One default background image and a further definiton with the ID-related background. In case the ID background file is not found, then the default background remains displayed.

For example a pseudo code of the icon element with two CSS classes:
<div class="background_icon background_icon_{$forum['fid']}"></div>
CSS:
/* Default background definition */
.background_icon {
background: url(images/icons/forumicons_{$forum['fid']}.png) 0 50% no-repeat;
width: 40px;
height: 40px;
line-height: xxx
...
}
/* Definition for existing icons */
.background_icon_7 { background-image: url(images/icons/forumicons_7.png); }
.background_icon_8 { background-image: url(images/icons/forumicons_8.png); }
.background_icon_33 { background-image: url(images/icons/forumicons_33.png); }

So you need to create a different background definition for each forum with an existing icon file. This will override the default. If there is no file/no defintion, the default background will be kept.

[ExiTuS]
(2020-05-15, 12:50 PM)[ExiTuS] Wrote: [ -> ]No, it is not possible to play with filenames und chose a default file.
And it is not beneficial to run the browser into loading a file that does not exist. This will cause one or more useless HTTP requests end up in file not found.

In this case you are better off using CSS and background images.
One default background image and a further definiton with the ID-related background. In case the ID background file is not found, then the default background remains displayed.

For example a pseudo code of the icon element with two CSS classes:
<div class="background_icon background_icon_{$forum['fid']}"></div>
CSS:
/* Default background definition */
.background_icon {
background: url(images/icons/forumicons_{$forum['fid']}.png) 0 50% no-repeat;
width: 40px;
height: 40px;
line-height: xxx
...
}
/* Definition for existing icons */
.background_icon_7 { background-image: url(images/icons/forumicons_7.png); }
.background_icon_8 { background-image: url(images/icons/forumicons_8.png); }
.background_icon_33 { background-image: url(images/icons/forumicons_33.png); }

So you need to create a different background definition for each forum with an existing icon file. This will override the default. If there is no file/no defintion, the default background will be kept.

[ExiTuS]


For example, if I want to add as you say, I must add the div tag and in the tag call the classes "background", in css I must add the url, I tried to do this but it did not work as such, it does not mark anything for me, I did it this way trying:


forumbit_depth2_forum
[Image: image.png]

This foro/css/style.css
[Image: image.png]


It doesn't work for me, I'm a novice in this, sorry