Getting {FORUM_IMAGE} to display in viewforum.php

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
teebling
Registered User
Posts: 52
Joined: Sat Apr 14, 2018 7:38 pm
Contact:

Getting {FORUM_IMAGE} to display in viewforum.php

Post by teebling »

Hey guys, would like some help with a simple bit of core code change on phpBB 3.2.5.

By default, any 'Forum Images' which are set in the ACP by the user will show in the forum row on the index page of the site. This is shown on the page by the template variable {forumrow.FORUM_IMAGE} in the template file forumlist_body.html. It is powered by the following code, found in includes/functions_display.php:

Code: Select all

'FORUM_IMAGE'			=> ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
'FORUM_IMAGE_SRC'		=> ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
- - - - - - - - - - - - - - -

What I would like is for the template variable {FORUM_IMAGE} to also be usable on viewforum_body.html as well. Which I assume means that I would have to copy the code above from includes/functions_display.php into viewforum.php in a similar location as well. I searched first and found this old topic from 3.0 in which someone had an identical request to me and got an answer which apparently worked, confirming that this is what you have to do - but, of course, it's not working.

- - - - - - - - - - - - - - -

To clarify then, what I have done so far is opened viewforum_body.html, inserted the template variable {FORUM_IMAGE} into it where I want it. Then I've gone into viewforum.php and around line 411 (after S_IS_POSTABLE in the template assign vars array) I have inserted the relevant code originally from includes/functions_display.php:

Code: Select all

'FORUM_IMAGE'			=> ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
'FORUM_IMAGE_SRC'		=> ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',

But it does not seem to work in phpBB 3.2.

- - - - - - - - - - - - - - -

Can anyone help me getting this working in phpBB 3.2? It seems I'm missing something obvious here or maybe something has changed since 3.0 which makes the original solution no longer workable.

Any help greatly appreciated.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 4579
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: Getting {FORUM_IMAGE} to display in viewforum.php

Post by kasimi »

Rather that $row, viewforum.php holds all forum data in the $forum_data array. Change all $rows in your code to $forum_data, i.e. $row['forum_image'] becomes $forum_data['forum_image'].
User avatar
teebling
Registered User
Posts: 52
Joined: Sat Apr 14, 2018 7:38 pm
Contact:

Re: Getting {FORUM_IMAGE} to display in viewforum.php

Post by teebling »

kasimi wrote:
Sat Jun 06, 2020 1:33 pm
Rather that $row, viewforum.php holds all forum data in the $forum_data array. Change all $rows in your code to $forum_data, i.e. $row['forum_image'] becomes $forum_data['forum_image'].
Kasimi - legend that you are - it worked! :D
Post Reply

Return to “phpBB Custom Coding”