This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

Adding last post's subject to index

Description: This article describes how to add the last post's subject to the index page of your board.

In Categories:

Link to this article: Select All
[url=https://www.phpbb.com/support/docs/en/3.0/kb/article/adding-last-posts-subject-to-index/]Knowledge Base - Adding last post's subject to index[/url]

phpBB already includes a template variable to display the last post's subject on the index page, but it's not currently used. If a subject is greater than 10 or 15 characters, the subject could span 2 or more lines. This article will explain how to not only add the subject to index page, but shorten it if it is more than 10 characters long.

First, open /includes/functions_display.php and find:

Code: Select all

'LAST_POST_SUBJECT'      => censor_text($last_post_subject),

Replace that line with:

Code: Select all

'LAST_POST_SUBJECT'      => (utf8_strlen(censor_text($last_post_subject)) > 10) ? utf8_substr(censor_text($last_post_subject), 0, 10) . '...' : censor_text($last_post_subject),

prosilver
Open /styles/prosilver/template/forumlist_body.html and find (note the code below is part of a larger line):

Code: Select all

<dfn>{L_LAST_POST}</dfn>

On the same line right before the text above, add:

Code: Select all

{forumrow.LAST_POST_SUBJECT}<br />

The whole line should look like this:

Code: Select all

<!-- IF forumrow.LAST_POST_TIME -->{forumrow.LAST_POST_SUBJECT}<br /><dfn>{L_LAST_POST}</dfn> {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}

subsilver2
Now, open /styles/subsilver2/template/forumlist_body.html and find

Code: Select all

<p class="topicdetails"><!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a>&nbsp;<!-- ENDIF -->{forumrow.LAST_POST_TIME}</p>
On a new line before that line add

Code: Select all

<p class="topicdetails">{forumrow.LAST_POST_SUBJECT}</p>

Now save all files and purge your cache. Your index page should now look like this:

prosilverImage

subsilver2Image

For those looking for more features, such as ACP controls, there are MODs, such as:
Latest Topic Title
NV advanced last topic titles
th23 Last Post Subject
There may be others in the Modification database.

  • Oyabun1 Added subsilver2 edit and MOD info