Last X topics from your phpBB...

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
z00om
Registered User
Posts: 23
Joined: Wed Nov 28, 2001 7:04 am
Contact:

Last X topics from your phpBB...

Post by z00om »

I know probably 99.9% of you either have this or can make one if you want, but heres a simple "last X topics" listing for your phpBB. I don't know if its any different, but I built it off a phpBB2 RC-1... Some mods may be needed for adaptation. Here you go:

Code: Select all

<?php 
/* gets last X topics from your phpBB */ 
/* settings... */ 
/* setup your mysql conn... */ 
mysql_connect("host","user","pass"); 
/* enter your DB */ 
mysql_select_db("database"); 
/* how many to display? */ 
	/* to display ALL, go and remove " LIMIT $display" from $get_q. */ 
$display = 5; 
/* character cut-off */ 
	/* (set to 0 for NO cut off) */ 
$cutoff = 20; 
/* if cutoff is used, what should be displayed after? */ 
	/* hint: usually "..." or something. */ 
$cutoffending = "..."; 
/* URL to your forum (DIRECTORY ONLY!) */ 
	/* ie: /phpBB2 */ 
	/* _NO_ trailing slash! */ 
$url = "/forums"; 
/* --- end settings! --- */ 


$get_q = "SELECT topic_id,topic_title FROM topics ORDER BY topic_id DESC LIMIT $display"; 
$get_r = mysql_query($get_q); 
while ($topic = mysql_fetch_row($get_r)) { 
	if ($cutoff != 0) { 
		if(strlen($topic[1]) > $cutoff) { 
			$link = substr($topic[1], 0, $cutoff) . $cutoffending; 
		} else { 
			$link = $topic[1]; 
		} 
	} else { 
		$link = $topic[1]; 
	} 
echo ". <a href=$url/viewtopic.php?t=$topic[0]>$link</a><br>\n"; 
} 
/* end... */ 
/* CREDIT: Scott Roberts - http://z00om.com */ 
?>
Hope it's good for something :)
Bear
Registered User
Posts: 2586
Joined: Mon Dec 31, 2001 7:50 pm
Location: 127.0.0.1
Contact:

Post by Bear »

I'm sure the folks over at mods.phpbb.com would like a post over there.
Bear
Got a thing for fashion? So do we at the Fashion Spot.
Let us give you the Royal Treatment at Les Tribunes Royales.
Matthijs
Former Team Member
Posts: 1031
Joined: Sat Dec 08, 2001 4:27 pm
Location: The Netherlands
Contact:

Post by Matthijs »

I know (since I did one myself) there are already a few posts there of a MOD doing this, and better (this one will display titles of topics in hidden forums).
phpBB Converter Team Member
Developer of the vBulletin 2.x.x -> phpBB 2.0.x Converter
See Matthijs.net for more info
dougk_ff7
Former Team Member
Posts: 1191
Joined: Fri Jul 06, 2001 3:17 am
Location: I dunno, I've lost it.
Contact:

Post by dougk_ff7 »

Although the developers appreciate the contribution of code, this is a mod, and it needs to be posted to http://mods.phpbb.com/. As for this topic, it's locked.
Sorry!
dougk_ff7.... stand by for sig! oooh! wow.
Locked

Return to “2.0.x Support Forum”