#---------------------------------------------------------------------------
#This is an add-on to ssi.php that will show the last posts on your board.
#Copyright (C) 2003 Jon Roكbach (Flexo)
#main parts of the code (C) 2003 Scott Barr (scoz)
#E-Mail: [email][email protected][/email]
#
#Features :
# shows topic-title,the forumname,author and date of post
# direct links to : the thread, the forum and userprofile
#
#---------------------------------------------------------------------------
# Step 1:
# Create a new file called lastposts.html in your ssi_templates directory.
# Fill it with this code :
<table style='border:1px dotted gray;width:100%;font-family:Verdana;font-size:10px'>
<tr>
<td>
<a href={thread_url} target="_blank">{thread_title}</a><br>
posted in : <a href={forum_url} target="_blank">{forum_name}</a><br>
written on {date}<br>
by <a href={profile_link} target="_blank">{author}</a>
</td>
</tr>
</table>
<br>
# Step 2:
# Open ssi.php
# Find the following code around line 139 :
case 'stats':
do_stats();
break;
# Add this code below:
case 'lastposts':
do_lastposts();
break;
# Step 3:
Around line 299 you should see:
echo $to_echo;
exit();
}
#After that add this :
//-------------------------------------------------
// Last Posts
//-------------------------------------------------
function do_lastposts() {
global $DB, $ibforums, $root_path, $templates_dir, $std, $INFO;
$admin_forums = '(0)'; // IDs of the Forums you want to hide;
$limit = "5"; // Number of posts to show
$prefix = $INFO['sql_tbl_prefix'];
$template = load_template("lastposts.html");
$to_echo = "";
$DB->query( "SELECT p.pid, p.author_name, p.post_date, p.forum_id, p.topic_id, p.author_id, t.title ,f.name FROM ".$prefix."posts p , ".$prefix."topics t, ".$prefix."forums f WHERE t.tid=p.topic_id AND t.forum_id=f.id AND p.forum_id NOT IN ".$admin_forums." ORDER BY pid DESC LIMIT 0,".$limit." " );
if ( ! $DB->get_num_rows() )
{
fatal_error("Could not get the information from the database");
}
while( $out = $DB->fetch_row($query) ) {
$thread_title = $out['title'];
$forum_name =$out['name'];
$author = $out['author_name'];
$out['post_date'] = $std->get_date( $out['post_date'], 'LONG' );
$date = $out['post_date'];
$to_echo .= parse_template( $template,array (
'thread_url' => $ibforums->base_url."?act=ST&f=".$out['forum_id']."&t=".$out['topic_id']."&hl=&#entry".$out['pid'],
'thread_title' => $thread_title,
'forum_url' => $ibforums->base_url."?act=SF&f=".$out['forum_id'],
'forum_name' => $forum_name,
'date' => $date,
'author' => $author,
'profile_link' => $ibforums->base_url."?act=Profile&CODE=03&MID=".$out['author_id'], ) );
}
// Parse template
echo "<table cellpadding='4' cellspacing='1' border='0' width='40%' bgcolor='#000000'style='font-family:Verdana;font-size:11px'>";
echo "<tr>";
echo "<td align='left' bgcolor='#CCCCCC'><b>Last Posts</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td align='left'bgcolor='#FEFEFE'>";
echo $to_echo;
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
}
# OPTIONAL (Step 4) :
#If you want to show all forums, just edit the following in the code:
$admin_forums = '(0)'; // IDs of the forums you want to hide;
#If you want to hide ONE forum, just edit the following in the code:
$admin_forums = '(23)'; // IDs of the forums you want to hide;
=> where "23" is the ID of the forum you want to hide
#If you want to hide MORE than one forum, just edit the following in the code:
$admin_forums = '(23,34,2,4)'; // IDs of the Forums you want to hide;
=> separate the forum IDs with a comma !
#If you want to change the number of last posts , just edit the following:
$limit = "5"; // Number of posts to show
#To use the mod on your web-site use:
<?php
include("http://domain.com/forums/ssi.php?a=lastposts");
?>