Adding Post Titles To Your Forum List in phpBB3
6 weeks after it’s release, I finally found the time to upgrade the forum over at Snackbar Games to phpBB 3. My hand was kind of forced due to some massive load that was generated on our phpBB2.x install and to appease the webhosting company, I told them I was going to upgrade to a clean install of phpBB3 with no mods or hacks installed.
The one thing I missed about my modded phpBB2.x forum was that the forumlist showed the topic or subject of the last post in that forum, something that phpBB3 lacks out of the box. Luckily there is a very easy way to add this functionality back in.
1. Go to your ACP and click on the Styles Tab.
2. Under Style Components on the left, click Templates
3. On the right, click the Edit button next to Prosilver. This should bring up a drop down list with all the available template files for the Prosilver theme.
4. Select ‘forumlist_body.html’ and let the lower half of the page refresh to display the current contents of that file.
5. Find the following block of code in your file:
<dd class="lastpost"><span> <!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn> {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} <a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{L_POSTED_ON_DATE} {forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></span> </dd> |
Change it to:
<dd class="lastpost"><span> <!-- IF forumrow.LAST_POST_TIME --><a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_SUBJECT}</a> <br /><dfn>{L_LAST_POST}</dfn> {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} <a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{L_POSTED_ON_DATE} {forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></span> </dd> |
All we did was add this small bit of code right inside the IF statement that checks the forumrow.LAST_POST_TIME variable. All this does, is builds a link to the last post in the thread and uses the subject line of this last post to display in the forumlist.
<a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_SUBJECT}</a> <br /> |
Ideally, the topic title would be displayed instead of the subject from the last post, but that information is not available without altering the query for the forumlist and I wanted to go with a simple fix here that didn’t alter any of the core code of the system. To see this small hack in action, head on over to the SBG forum.
29 Jan 2008 12:18 pm Chris 0 comments