Your ultimate PunBB resource!
You are not logged in.
## ## ## Mod title: Last Topic on Index ## ## Mod version: 1.0 ## Works on PunBB: 1.2.* ## Release date: 26.09.2008 ## Author: René Wagner (poellche) - apollo@rw-net.de ## ## Description: Shows the title of the topic with the latest post on the index page of the forum. ## ## Affects DB: forums ## ## Affected files: include/functions.php ## plugin/AP_Forum_cleanup.php ## index.php ## ## Notes: Database changes can be installed using the install_mod.php-script. ## ## DISCLAIMER: Please note that 'mods' are not officially supported by ## PunBB. Installation of this modification is done at your ## own risk. Backup your forum database and any and all ## applicable files before proceeding. ##
Offline
Is this different from:
http://wiki.punres.org/Last_post%27s_su … orum_index ?
Offline
Hi there,
the methods are bit different in a technical way, although you`ll get the same results.
The mod shown in the Wiki adds an additional join to the topic table when the data for the index page is collected. This will result in a performance drop when building the index-page on big sites with many different forums and a huge topics-table, cause the database will have a major task to solve.
My method adds the required data to the forums-table, the field is stored when the forums-table needs to be updated anyway, so there is nearly no performance hit with this method. btw: the data of the last poster and last post time is stored the same way.
The disadvantage of my method is that you´ll need to do some more customizing.
Greetings poellche
Last edited by poellche (2008-09-30 11:01:35)
Offline
Aha. Thanks for the analysis. It was useful, particularly from a performance tuning perspective.
Offline
you totally rock
thank you alot
i was so dissapointed about my forum index heavy load with that wiki explanation
i even merged this addon with subforums and result was perfect
Last edited by gorsan (2008-10-30 23:46:57)
Offline
I've tried this mod but it gives me an error when I add the following line:
if ( strlen($cur_forum['last_topic']) > 50 )
$cur_forum['last_topic'] = substr($cur_forum['last_topic'], 0, 50) . '...';
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).': <span class="byuser">'.pun_htmlspecialchars($cur_forum['last_topic']).'</span>';Offline
I really don't know how you guys can say this mod works. I have tried this so many times and it simply does not work. I am using a brand new install of punbb. I would also like to know where does it display the topic as the link on the index. As far as I can see, it still displays the time as the link to the last post. Can I see a working example of this mod?
Crusader.
Offline
Hi crusader,
for example the mod is working at this forum.
I just added to line you have posted earlier to that forum and it works perfect. Seems to me that the error is not in the lines added by the mod, but in the lines surrounding it. Please post the code snippet including the previous and following 10 lines of code.
I never said that the topic title is linked to the topic. Its still the way it is with a fresh install: the date and time of the last post is linked to the topic.
But you can achieve that with a very small adjustment.
Replace:
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).': <span class="byuser">'.pun_htmlspecialchars($cur_forum['last_topic']).'</span>';
With:
$last_post = format_time($cur_forum['last_post']).' '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).': <span class="byuser"><a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.pun_htmlspecialchars($cur_forum['last_topic']).'</a></span>';
Kind regards
poellche
Offline
Hi,
its exactly the way i described it. I never mentioned anything about a topic title linked to the topic, i only mentioned the topic title is shown at the index page. I have no clue what "last topic on index" means in other mods, in my mod it just means what the words are about.
As stated in my previous post, you can get the layout you want by simply changing a single line.
btw you did not mention anything about the error you reported early? Could you solve the issue by yourself?
Kind regards
poellche
Offline
yes, I had to remove the line just above it. Anyway, all I am saying is there is already a mod on the wiki called: Last Topic Index that basically takes the last topic (title) and this becomes the link to the (last) post. You can see my modification of it on http://raynedown.com
Cheers!
Shedrock
Offline
Hi,
well, i know about the mod in the wiki, it´s the one seesaw talked about in post #2 of this thread and i tried to explain what are the differences between my mod and the one in the wiki in post #3.
Kind regards
poellche
Offline