MyBB Community Forums

Full Version: Latest Topics?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Is there a way to show on a regular HTML page links to the last 5 or so topics that have been posted to? I know of similiar mods for phpbb and was wondering how I could do that with mybb.

EDIT: Answer to solution can be found here: http://mybboard.com/community/showthread...6#pid12296
html Confused Impossible. You'll have to use php so you can select the info from the database.
k776 Wrote:html Confused Impossible. You'll have to use php so you can select the info from the database.
Yep, I should have said that. So, how can I do with as a php page that I insert in an HTML page via iframe?
I think there was a tutorial at mybbplanet.com about grabbing news or new posts from forums to sites, but they are down at the moment.
I think you could use javascript to put it into an html page. I am not sure if this would work though.
AustinC. Wrote:I think you could use javascript to put it into an html page. I am not sure if this would work though.

Your javascript src="" attribute must be linked to a PHP page that generates the latest topics and outputs it in Javascript.
DennisTT Wrote:
AustinC. Wrote:I think you could use javascript to put it into an html page. I am not sure if this would work though.

Your javascript src="" attribute must be linked to a PHP page that generates the latest topics and outputs it in Javascript.

Exactly, I dont use java script at all but I think this is the code:
<script>
scr="FILENAME.EXTENTION"
</script>
And just replace FILENAME with your filename and EXTENTION with your file exention, ei., php.
I am not sure if that is the code though. Toungue
Sorry, still lost. How do I get the original page that will generate a list of the last 5 topics that have been posted to?
here, i'll write out the code that you can use..

<?php
/*/ latest topic code
written by p0iz @ roflnub.com
for QuickGold
/*/

// db config stuff
$username = "db_username";
$password = "db_pw";
$database = "database";

// connect

$connect = mysql_pconnect("localhost","$username","$password");
if(!$connect){
	echo"couldnt connect..";
}

$omg = mysql_select_db($database);
if(!$omg){
	echo"couldnt select database..";
}

// get latest topics..

$query = mysql_query("SELECT * FROM mybb_threads ORDER BY `tid` DESC LIMIT $tlimit");
while($fetch = mysql_fetch_array($query)){
	echo"$fetch[subject]";
}
?>

hope that helps, just change the database info to your sql info. also, if you didnt use the default prefix when isntalling, change the mybb_threads to prefix_threads

[b]note, i dont know if this works or not, it probbaly does, i just now coded it, without testing Wink
Then you would want to save Poison's code with a name like topics.php. The you would want to have a code like this:
<script>
scr="http://www.yoursite.com/topics.php"
</script>
...I think that is the code, if anyone else knows better then please correct me.

NOTE - The file extention MUST be .php for Poison's script to work.
Pages: 1 2 3 4