View Single Post
  #67  
Old 5th April 2008, 07:15
djlee's Avatar
djlee djlee is offline
Senior Member
 
Join Date: Mar 2008
Posts: 183
Default re: X-Fusion Tracker
i could probably figure out how to do it given time .. i'll see if i can set up TS on my home server and have a quick look .. otherwise u cud set me up a temp ftp/ssh account to do it for ya .. but i'll attempt it on my localhost first if i dont have to piss about too much getting it setup for testing

EDIT: ok think ive got this pretty much solved.. gotta say thanks for requesting this mod .. been a while since ive done any more than a few lines coding that ive actually enjoyed

first a few things to point out first. do it this way so i know you will read it before you copy and paste and think your done lol
  1. the number of posts you want to display can be set via the $fetchposts variable
  2. i have set a $prefix variable just incase u changed the phpbb_ prefix from default when importing teh SQL for the forum. this saves ppl having to go through the sql changing it all. if you did change teh prefix make sure you ammend this
  3. at the moment only basic user posts can be viewed here. staff posts for example are not seen in here period.. as i've literraly never worked with PHPBB forums i couldnt figure this out just yet. If its something important to a lot of people that want to use this mod then i may add it. Otherwise i cant be bothered
  4. the current hieght allowed for the frame is 200pixels. To change the height allowed simply change the height defined in the style attribute of the div tag
  5. I have made it scrollable so that on long posts your index doesn't suddenly become stupidly streched. This way the user just scrolls. If you don't like this then you can remove the two tags and this will simply give you a standard table however be careful as if someone makes a long post it will make ur index extremly big until it 5 more posts have been made (and if those 5 posts are also long well you can imagine the effect)

ok onto the code. its as simple as cut and paste .. or atleast it should be lol
Code:
<?
//******************************************
// Last X POSTS in PHPBB2 FORUM MOD BY DJLEE
//******************************************

$fetchposts = 5; //Number of Posts to get?
$prefix = phpbb_; //the phpbb forum posts prefix (phpbb_ by default)
$res = mysql_query("SELECT ".$prefix."posts.post_id, ".$prefix."posts.topic_id, ".
                   $prefix."posts.poster_id, ".$prefix."posts_text.post_text, ".
                   $prefix."topics.topic_title, ".$prefix."users.username, ".
                   $prefix."users.user_id ".
                   "FROM(".$prefix."posts LEFT JOIN ".$prefix."posts_text ON ".
                   $prefix."posts.post_id = ".$prefix."posts_text.post_id LEFT JOIN ".
                   $prefix."topics ON ".$prefix."posts.topic_id = ".
                   $prefix."topics.topic_id LEFT JOIN ".
                   $prefix."users ON ".$prefix."posts.poster_id = ".
                   $prefix."users.user_id LEFT JOIN ".
                   $prefix."forums ON ".$prefix."posts.forum_id = ".$prefix.
                   "forums.forum_id) WHERE ".$prefix."forums.auth_read = 0 ".
                   "ORDER BY ".$prefix."posts.post_time DESC LIMIT ".
                   $fetchposts."") or sqlerr(__FILE__,__LINE__);

begin_frame("Last $fetchposts Forum Posts",false,5);

if(mysql_num_rows($res) > 0)
 {
 echo "<div style='height: 200px; overflow: scroll;'><table>";
 while($arr = mysql_fetch_assoc($res))
  {
  echo "<tr>";
  echo "<td style='vertical-align: top; padding-right: 5px;'>[b]".$arr['username']."[b]: </td>";
  echo "<td>".$arr['topic_title']."
".format_comment($arr['post_text'])."</td>";
  echo "</tr>";
  }
 echo "</table></div>";
 }
else
 echo "No Forum Posts have been made. Will you be the first?";
 
end_frame();

//******************************************
// LAST X POSTS BY DJLEE END
//******************************************
?>
simply stick that wherever in your index you want the table to appear... it should work on all pages of the site not just index but you may need to mess around with the style a little on other pages depending on where u stick it .. but for index ur fine :P

well hopefully you wont have any problems. if you do just post back and it would be helpful if you have a problem to post back with your index.php so i can check it for ya straight away.. leaving the credits to the mod would also be nice lol :P
Reply With Quote