PDA

View Full Version : Random forum post on homepage


Simplicity
08-20-2006, 06:29 PM
I have got a plugin which displays a random post from certain forums on my homepage, however it only displays the thread name (in a hyperlink to the post) and the authors name.

What I need to know is what code to add so that a certain number of characters are displayed from the actual post with a 'view complete post..' hyperlink to the post. I have posted the code currently used to display the random post.

Could someone please help me with this?

Kind regards.

if( ($forumname == 'vBulletin 2') || ($forumname == 'vBulletin 3') )
{
$thread = $DB->query_first("SELECT title, threadid, lastposter FROM ".$tableprefix."thread ".$extraquery." ORDER BY rand() LIMIT 1");

$thread['title'] = sd_wordwrap($thread['title'], $wordwrap, "<br />", 1);
$thread['lastposter'] = sd_wordwrap($thread['lastposter'], $wordwrap, "<br />", 1);

echo '<a href="' . $sdurl . $forumpath . 'showthread.php?threadid=' . $thread['threadid'] . '&goto=lastpost">' . $thread['title'] . '</a>
<br />' . $language['posted_by'] . ' ' . $thread['lastposter'] . '<br /><br />';
}