Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
Old 10-17-2007, 10:28 AM phpBB Latest Posts
Galaxian's Avatar
Rich Powell

Posts: 842
Name: Rich Powell
Location: United Kingdom
Trades: 0
This is for phpBB 2 that I custom made

PHP Code:
$headlines_num 8;
$prefix 'phpbb_';
// Have a forum you don't want latest posts displaying? If you have more just edit the $sql to include more of the forum_id != or if you don't want this just remove it
$forum_bypass 0;


//show headlines
$sql 'SELECT topic_title, topic_id, topic_time, topic_last_post_id FROM '.$prefix.'topics WHERE forum_id != $forum_bypass ORDER BY topic_last_post_id DESC LIMIT 0,'.$headlines_num.'';
$out mysql_query($sql) or die(mysql_error());
$count 1;
while(
$row mysql_fetch_assoc($out)){

$sql2 'SELECT topic_id, post_time, poster_id FROM '.$prefix.'posts WHERE post_id = '.$row['topic_last_post_id'].' ORDER BY post_id DESC LIMIT 1';
$out2 mysql_fetch_array(mysql_query($sql2)) or die(mysql_error());

$sql3 'SELECT username FROM '.$prefix.'users WHERE user_id = '.$out2['poster_id'].' limit 1';
$out3 mysql_fetch_array(mysql_query($sql3)) or die(mysql_error());

    echo 
'<p><strong><a href="forums/viewtopic.php?p='.$row['topic_last_post_id'].'#'.$row['topic_last_post_id'].'">'.$row['topic_title'].'</a></strong><br />By <a href="forums/profile.php?u='.$out2['poster_id'].'"><strong>'.$out3['username'].'</strong></a><br /><span class="smltime">' elapsed_time($out2['post_time']) . '</span></p>';

Yes the layout of the code is tatty and the sql is not joined but oh well. Also you may have to edit the path to your current one instead of /forums
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please help get the new
Please login or register to view this content. Registration is FREE
forum started for Webmasters like you!

Galaxian is offline
View Public Profile Visit Galaxian's homepage!
 
 
Register now for full access!
Old 10-17-2007, 11:16 AM Re: phpBB Latest Posts
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Thank you ^^ Useful post.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
View Public Profile Visit rogem002's homepage!
 
Closed Thread     « Reply to phpBB Latest Posts
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.76101 seconds with 12 queries