How to change the forum icon to a forum image?

@halilesen · 05 Apr 2024 · 720 views
Post Reply
User avatar
halilesen
#1 ·
Posts: 55
Joined: 24 Mar 2024, 18:09
Full Name: Halil ESEN
Has liked: 11
Been liked: 9
When creating a new forum or editing the forum settings in ACP, it is possible to add a forum image. But when you add a forum image, it looks like a redundancy next to the forum icon. Someone must go. Of course, since you was adding an image specific to that forum, this should replace the forum icon. In this topic I will show you how you can do this.

Upload the forum image to the /images folder in the phpBB root directory. This will make it simpler to add a forum image in ACP. Just type in the relevant input like this: /images/forumimage.jpg

In order for the forum image you add to a forum to replace the existing forum icon, we need to edit the /template/forumlist_body.html file of the style you are using. First, find this:

Code: Select all

<dl class="row-item {forumrow.FORUM_IMG_STYLE}">
and change it with this:

Code: Select all

<dl class="row-item<!-- IF not forumrow.FORUM_IMAGE --> {forumrow.FORUM_IMG_STYLE}<!-- ENDIF -->">
then find this:

Code: Select all

<a href="{forumrow.U_VIEWFORUM}" class="row-item-link"></a>
replace it with this:

Code: Select all

<a href="{forumrow.U_VIEWFORUM}" class="row-item-link"><!-- IF forumrow.FORUM_IMAGE -->{forumrow.FORUM_IMAGE}<!-- ENDIF --></a>
Finally, find this and delete it:

Code: Select all

<!-- IF forumrow.FORUM_IMAGE -->
	<!-- EVENT forumlist_body_forum_image_before -->
	<span class="forum-image"><!-- EVENT forumlist_body_forum_image_prepend -->{forumrow.FORUM_IMAGE}<!-- EVENT forumlist_body_forum_image_append --></span>
	<!-- EVENT forumlist_body_forum_image_after -->
<!-- ENDIF -->
Save it.

If forum image is too large, it may be misshapen. You can use this CSS code to give your forum image the size of its predecessor, the forum icon:

Code: Select all

dl a.row-item-link img {
    width: inherit;
}
In this way, we have ensured that the forum images you add in your phpBB board replace the existing forum icons. Moreover, only forums where you have added forum images will be affected.

If you don't preserve these changes in style updates, you'll have to do it all over again. On the other hand, for your convenience, I am sharing the edited version of the forumlist_body.html file the default Prosilver style:

forumlist_body.zip
(1.69 KiB) Downloaded 55 times

Feel free to write if you have any questions or if you have ideas to make the code better.
Post Reply
  • Similar Topics