Reply
Old December 29th, 2002 Top | #1
 
sboulema's Avatar
OSNN Veteran Addict
Joined: June 2002
Location: Amstelveen, The Netherlands
Posts: 2,846
Reputation: 120
Power: 151

Question latest posts

Im making a invision forum and i wanna know how i can get a list of the latest 5 post on my site.

im a complete php newbie, so please be very clear. Hope you guys can help me.
sboulema is offline   Reply With Quote
Old December 29th, 2002 Top | #2

OSNN Folding Team  
Electronic Punk's Avatar
The Last High
Joined: December 2001
Location: London
Posts: 18,510
Blog Entries: 51
Reputation: 3652
Power: 349

Default

Make a new file or function with the foillowing content:

Code:
$recentforumget = 5; // Number of posts to get
$recentforumlength = 30; // Length of title to display before cutting off
$forumexclude = ""; // Add forum id's to exclude from get (eg private ones) sepetate by a comma

$getposts = query("SELECT tid,title,forum_id FROM ".$ibf_prefix."topics WHERE  (state <> 'link')".iif($forumexclude," AND (forum_id NOT IN ($forumexclude))")." ORDER BY last_post DESC LIMIT $recentforumget");

while ($post = fetch_array($getposts)) {
$post[short_title] = iif(strlen($post[title]) > $recentforumlength,substr($post[title],0,$recentforumlength)."...",$post[title]);
$post[full_title] = $post[title];
$recentforumposts .= "<a href=\"$forumpath/index.php?act=ST&f=$post[forum_id]&t=$post[tid]\" title=\"$post[full_title]\">$post[short_title]</a><br />\n";
}

Electronic Punk is offline   Reply With Quote
Old December 29th, 2002 Top | #3
 
sboulema's Avatar
OSNN Veteran Addict
Joined: June 2002
Location: Amstelveen, The Netherlands
Posts: 2,846
Reputation: 120
Power: 151

Default

hmmm.... :confused: You have to help me a bit more. Where do i have to put this code. Im a extremely newbie i need everything i steps Thanks for helping me
sboulema is offline   Reply With Quote
Old December 29th, 2002 Top | #4

OSNN Folding Team  
Zedric's Avatar
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175

Cool

Put the code anywhere (pretty much) inside <? ?> -tags.
Then at the place you want to print the links type in:
<?=$recentforumposts?>


Did I help you? Please use the reputation system. Click the icon on the left!
Proud host of the OSNN.net folding sigs. Want one? Check the folding thread!
http://zedric.no-ip.com/
Zedric is offline   Reply With Quote
Old December 29th, 2002 Top | #5
 
sboulema's Avatar
OSNN Veteran Addict
Joined: June 2002
Location: Amstelveen, The Netherlands
Posts: 2,846
Reputation: 120
Power: 151

Default

this is what i have now and it still not work, what am i doing wrong:

<?
$recentforumget = 5; // Number of posts to get
$recentforumlength = 30; // Length of title to display before cutting off
$forumexclude = ""; // Add forum id's to exclude from get (eg private ones) sepetate by a comma

$getposts = query("SELECT tid,title,forum_id FROM ".$ibf_prefix."topics WHERE (state <> 'link')".iif($forumexclude," AND (forum_id NOT IN ($forumexclude))")." ORDER BY last_post DESC LIMIT $recentforumget");

while ($post = fetch_array($getposts)) {
$post[short_title] = iif(strlen($post[title]) > $recentforumlength,substr($pos
t[title],0,$recentforumlength)
."...",$post[title]);
$post[full_title] = $post[title];
$recentforumposts .= "<a href=\"$forumpath/index.php?act=ST&f=$post[forum_id]&t=$post[tid]\" title=\"$post[full_title]\">$post[short_title]</a><br />\n";
}
?>

<?=$recentforumposts?>
sboulema is offline   Reply With Quote
Old December 29th, 2002 Top | #6

OSNN Folding Team  
Zedric's Avatar
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175

Cool

Have you made the connection to the database? Do you get an error?


Did I help you? Please use the reputation system. Click the icon on the left!
Proud host of the OSNN.net folding sigs. Want one? Check the folding thread!
http://zedric.no-ip.com/
Zedric is offline   Reply With Quote
Old December 29th, 2002 Top | #7
 
sboulema's Avatar
OSNN Veteran Addict
Joined: June 2002
Location: Amstelveen, The Netherlands
Posts: 2,846
Reputation: 120
Power: 151

Default

hmmm i get a bunch of weird text, but no error. But nevermind i installed the Invision Portal and that does exactly what i want. Thanks for helping me.
sboulema is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
Latest Artwork ~bk Graphic Design 9 August 18th, 2005 8:39pm
Latest WMP 9 Build.... ThesiS Windows Desktop Systems 3 November 6th, 2002 1:59am
Latest Microangelo? renakuajo Windows Desktop Systems 3 October 31st, 2002 4:43pm
My Latest Wallpapers... Grandmaster Desktop Customisation 4 August 15th, 2002 4:08am
"Latest 5 Posts" BLEHg0d Green Room 4 February 19th, 2002 8:20pm