Jump to content
xisto Community
soleimanian

Need Php Script>>show Last 10 Topics In IPB

Recommended Posts

You can modify this script to make it work with IPB standalone but I use it on a IPB-Nuke site to scroll the messages that have been posted in my forums. I am not sure where you would like them to show but using a CMS like nuke it works fine. Here's the script for you to tinker around with,

global $prefix, $db, $sitename;$result = $db->sql_query("SELECT forum_id, topic_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_time DESC LIMIT 10");$content = "<br>";while ($row = $db->sql_fetchrow($result)) {    $forum_id = intval($row['forum_id']);    $topic_id = intval($row['topic_id']);    $topic_title = $row['topic_title'];    $row2 = $db->sql_fetchrow($db->sql_query("SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id='$forum_id'"));    $auth_view = intval($row2['auth_view']);    $auth_read = intval($row2['auth_read']);    if (($auth_view < 2) OR ($auth_read < 2)) {        $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\"> <a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id\">$topic_title</a><br>";    }}$content .= "<br><center><a href=\"modules.php?name=Forums\"><b>$sitename Forums</b></a><br><br></center>";
If you would like to see how the above script works on a PHP-Nuke using the IPB board for forums then the link is NukeXtra IPB-Nuke Site Look at the left hand side of the page and you will see Last Posts just below Languages.

Share this post


Link to post
Share on other sites

Try this :P

<style> body { font-family: Verdana; font-size: 10px; } .name { font-size: 11px; color: red; // text } #topic { height: 15px;  padding: 2px; } #topic:hover { background: #D8D8D8; // on mouse over  color: black; } #bubble { width: 25px; margin: 2px 0px 5px 210px; height: 18px; text-align: center; line-height: 12px; position: absolute; font-size: 9px; color: #000000; } #bord { border-top: 1px dotted #9f9f9f;  height: 0px; } #cont { width: 100%; } </style> <?php $forums = "forum"; // forum url $limits = "12"; // how much will show $size = 25; //how many simbols can be in topic lenght  $host = "localhost"; $dbname = "database";  $dbuser = "user";  $dbpass = "password"; $link = mysql_connect($host, $dbuser, $dbpass) or die("Could not connect: " . mysql_error()); mysql_select_db($dbname) or die("No DB"); mysql_query("SET NAMES UTF-8"); // for latvian language $kveri = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics ORDER BY last_post DESC LIMIT ".$limits.""); // izvadam jaunumus echo "<div id='cont'>"; echo "<div id='bord'></div>"; while($row = mysql_fetch_array( $kveri )) { echo "<a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"> <div id='topic'> <div id='bubble'>".$row[posts]."</div> <span class='name'>"; if(strlen($row[title])>$size){ [tab][/tab][tab][/tab]echo substr($row[title], 0, $size)."..."; }else{ [tab][/tab][tab][/tab]echo $row[title]; } echo "</span> </div></a> <div id='bord'></div>"; } echo "</div>"; ?>

Edited by spawN-eD (see edit history)

Share this post


Link to post
Share on other sites

 

Try this :huh:

<style>body {font-family: Verdana;font-size: 10px;}.name {font-size: 11px;color: red; // text}#topic {height: 15px;padding: 2px;}#topic:hover {background: #D8D8D8; // on mouse overcolor: black;}#bubble {width: 25px;margin: 2px 0px 5px 210px;height: 18px;text-align: center;line-height: 12px;position: absolute;font-size: 9px;color: #000000;}#bord {border-top: 1px dotted #9f9f9f;height: 0px;}#cont {width: 100%;}</style><?php$forums = "forum"; // forum url$limits = "12"; // how much will show$size = 25; //how many simbols can be in topic lenght$host = "localhost";$dbname = "database";$dbuser = "user";$dbpass = "password";$link = mysql_connect($host, $dbuser, $dbpass)or die("Could not connect: " . mysql_error());mysql_select_db($dbname) or die("No DB");mysql_query("SET NAMES UTF-8"); // for latvian language$kveri = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics ORDER BY last_post DESC LIMIT ".$limits."");// izvadam jaunumusecho "<div id='cont'>";echo "<div id='bord'></div>";while($row = mysql_fetch_array( $kveri )) {echo "<a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"><div id='topic'><div id='bubble'>".$row[posts]."</div><span class='name'>";if(strlen($row[title])>$size){[tab][/tab][tab][/tab]echo substr($row[title], 0, $size)."...";}else{[tab][/tab][tab][/tab]echo $row[title];}echo "</span></div></a><div id='bord'></div>";}echo "</div>";?>



Hey! i try this and don't work my site don't show nothing

<?php$forums = "http://forums.xisto.com/no_longer_exists/;; // forum url$limits = "10"; // how much will show$size = 25; //how many simbols can be in topic lenght$host = "localhost";$dbname = "l2rivendel_foro";$dbuser = "hidden";$dbpass = "hidden";$link = mysql_connect($host, $dbuser, $dbpass)or die("Could not connect: " . mysql_error());mysql_select_db($dbname) or die("No DB");mysql_query("SET NAMES UTF-8"); // for latvian language$kveri = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics ORDER BY last_post DESC LIMIT ".$limits."");// izvadam jaunumusecho "<div id='cont'>";echo "<div id='bord'></div>";while($row = mysql_fetch_array( $kveri )) {echo "<a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"><div id='topic'><div id='bubble'>".$row[posts]."</div><span class='name'>";if(strlen($row[title])>$size){[tab][/tab][tab][/tab]echo substr($row[title], 0, $size)."...";}else{[tab][/tab][tab][/tab]echo $row[title];}echo "</span></div></a><div id='bord'></div>";}echo "</div>";?>

My ipboard is 3.4.1
Edited by sewan (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.