Customizing SMF > Tips and Tricks
[TIP] vBulletin style messageindex links
darrenbeige:
vBulletin automatically populates the title of links in the MessageIndex to a snippet of that topics first post. With a change to just one line, you can replicate the same effect with SMF.
In Sources/MessageIndex.php:
--- Code: (Find) ---'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" >' . $row['firstSubject'] . '</a>'
--- End code ---
--- Code: (Replace ) ---'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" title="'. $row['firstBody'].'">' . $row['firstSubject'] . '</a>'
--- End code ---
This will show the browser's default 'tooltip' window with a snippet of the message. If you would like to increase the size of the preview, then look a little way above the line you have just edited and change every instance of 128 to the new length. This will increase the size of the preview, however it does slow SMF considerably, as censorText has to iterate over more and more words. There is a negligible PHP performance hit as this data is already loaded in an SMF default installation, but there may be a slight end-user-slowdown as - due to there being more HTML in the source of the page - it naturally takes longer for the browser to download all the content.
To be honest, I don't know why this isn't a default option in SMF, I mean the data's already loaded (and seems to be unused).
Thanks,
Arantor:
Looks good. I moved it here for others to use too.
darrenbeige:
Thanks for moving it. Why don't they allow posting direct to Tips and Tricks?
BTW, am I right in thinking that firstBody, and lastBody are never used, but loaded 'unneccesarily'? If so, I'm thinking about removing the SQL select for lastBody to speed up my code.
Arantor:
The idea is so that only legitimate tips/tricks get posted here, and not endless topics on supporting them too, much as it is in the Modifications and Packages board.
Just updating the SQL select may not produce a huge benefit on its own, but I seem to recall you can't remove the second join. I can't remember offhand if the censor is called separately on them or not.
darrenbeige:
--- Quote from: Arantor on October 11, 2009, 04:55:05 PM ---Just updating the SQL select may not produce a huge benefit on its own, but I seem to recall you can't remove the second join. I can't remember offhand if the censor is called separately on them or not.
--- End quote ---
I'll have a play around. I still can't see why they are there, when they are not used in a default installation.
Navigation
[0] Message Index
[#] Next page
Go to full version