How about a mod for random posts or threads? I want to have a certain section in the forum that automatically shows a random post (or thread)...
That'd be good actually
Anyone?
QuoteHow about a mod for random posts or threads? I want to have a certain section in the forum that automatically shows a random post (or thread)...
I really like this. Any takers? Random post in the forum... :D
Still no takers? ;)
Display random post
http://www.tinyportal.net/index.php?topic=8111.0
$ff_boardname = 'Tips and Tricks';
$ff_maxlength = 1024;
$ff_boards = ssi_topBoards( 100, 'return' );
foreach ($ff_boards as $ff_board)
{
if ($ff_board['name'] == $ff_boardname)
{
$ff_numtopics = $ff_board['num_topics'];
$ff_boardID = $ff_board['id'];
}
}
$ff_randomtopic = rand( 0, $ff_numtopics - 1 );
ssi_boardNews($ff_boardID, 1, $ff_randomtopic, $ff_maxlength, 'echo');
Random post displayer with banner option from http://www.tinyportal.net/index.php?topic=8155.0
$ff_boardname = 'Advertisments and Banners'; // The forum name.
$ff_maxlength = 1024; // Limit the length of the post.
$ff_bannersystem = 0; // make this so it cuts out all text aside from the first link found.
$ff_limitimagewidth = 150; // 0 = no limit.
$ff_boards = ssi_topBoards( 100, 'return' );
foreach ($ff_boards as $ff_board)
{
if ($ff_board['name'] == $ff_boardname)
{
$ff_numtopics = $ff_board['num_topics'];
$ff_boardID = $ff_board['id'];
}
}
$ff_randomtopic = rand( 0, $ff_numtopics - 1 );
$ff_news = ssi_boardNews($ff_boardID, 1, $ff_randomtopic, $ff_maxlength, 'return' );
foreach ($ff_news as $ff_new)
{
$ff_new_subject = $ff_new['subject'];
$ff_new_body = $ff_new['body'];
$ff_new_href = $ff_new['href'];
$ff_new_link = $ff_new['link'];
$ff_new_replies = $ff_new['replies'];
$ff_new_new_comment = $ff_new['new_comment'];
$ff_new_new_poster = $ff_new['poster']['link'];
$ff_startstring = strpos ( $ff_new_body, '<a href' );
$ff_endstring = (strpos ( $ff_new_body, '</a>' ) + 4) - $ff_startstring;
if ($ff_startstring != -1 && $ff_bannersystem == 1)
{
$ff_new_body = substr ( $ff_new_body, $ff_startstring , $ff_endstring );
}
$ff_startstring = strpos ( $ff_new_body, '<img src' );
if ($ff_startstring != -1 && $ff_limitimagewidth > 0)
{
$ff_x = 0;
$ff_y = $ff_startstring;
while ($ff_y != FALSE && $ff_x < 100)
{
$ff_x = $ff_x + 1;
$ff_new_body = substr_replace($ff_new_body, '<img width=' . $ff_limitimagewidth . ' src', $ff_startstring, 8);
$ff_startstring = strpos ( $ff_new_body, '<img src' );
$ff_y = $ff_startstring;
}
}
echo '<div class="tborder" style="margin-bottom: 0px;"><div class="titlebg" style="padding: 4px; font-weight: bold;"><a href="javascript: void(0);" onclick="toggle(11)"><img id="blockcollapse11" style="margin: 0;" align="right" src="http://www.sldrama.com/Themes/default/images/collapse.gif" border="0" alt="" ></a>';
echo $ff_new_subject;
echo '</div><div class="windowbg" style="padding: 4px; " id="block11"><div align="center">';
echo $ff_new_body;
echo '</div></div></div>';
}
Almost twelve years later...
Was looking for such functionality. Anyboday has any idea whether the mod above still works or not?
TinyPortal is still very much alive: the code mentioned would need to be added into a TP block...