Advertisement:

Author Topic: Random Post or Thread  (Read 3602 times)

Offline geezmo

  • Full Member
  • ***
  • Posts: 441
Random Post or Thread
« on: May 03, 2006, 12:50:09 AM »
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)...

Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: Random Post or Thread
« Reply #1 on: May 03, 2006, 09:25:24 AM »
That'd be good actually
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline geezmo

  • Full Member
  • ***
  • Posts: 441
Re: Random Post or Thread
« Reply #2 on: May 06, 2006, 02:47:01 PM »
Anyone?

Quote
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)...

Offline geezmo

  • Full Member
  • ***
  • Posts: 441
Re: Random Post or Thread
« Reply #3 on: May 13, 2006, 06:03:07 PM »
I really like this. Any takers? Random post in the forum... :D

Offline geezmo

  • Full Member
  • ***
  • Posts: 441
Re: Random Post or Thread
« Reply #4 on: June 21, 2006, 11:07:41 AM »
Still no takers? ;)

Offline Metal_13

  • Jr. Member
  • **
  • Posts: 126
    • Pinoytambay.com
Re: Random Post or Thread
« Reply #5 on: February 02, 2007, 11:33:45 AM »
    
Display random post
http://www.tinyportal.net/index.php?topic=8111.0

Code: [Select]
$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
Code: [Select]
$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>';
}
« Last Edit: February 02, 2007, 11:35:17 AM by metal13 »

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Random Post or Thread
« Reply #6 on: November 20, 2018, 09:41:25 AM »
Almost twelve years later...

Was looking for such functionality. Anyboday has any idea whether the mod above still works or not?

Offline @rjen

  • Full Member
  • ***
  • Posts: 509
  • Gender: Male
Re: Random Post or Thread
« Reply #7 on: November 20, 2018, 10:29:00 AM »
TinyPortal is still very much alive: the code mentioned would need to be added into a TP block...
Running SMF 2.0 with Tinyportal 1.6.4 at www.fjr-club.nl
Testing SMF 2.1 RC2 with Tinyportal at http://test2.fjr-club.nl/