2008-12-31, 10:18 PM
Thank you! Worked for me, after I realized I have to edit the path also in the MyBBLatest.class.php file, and not just in the actual page where I put the code. Now I just need to tweak the css to make it look nicer.
<?php
echo "{$threadlist}";
?>
<? php
$forumpath = './'; //enter your forum path
chdir($forumpath);
define("IN_MYBB", 1);
require './global.php';
require_once MYBB_ROOT."inc/class_parser.php";
?>
<?php
include("inc/config.php");
@mysql_connect($config['database']['hostname'],$config['database']['username'],$config['database']['password']) or die(mysql_error());
@mysql_select_db($config['database']['database']);
// son x konu
$konu_sayisi = '10';
// sorgu
$sorgu = @mysql_query("SELECT * FROM `".$config['database']['table_prefix']."posts` WHERE `replyto` = '0' ORDER BY `pid` DESC LIMIT 0,$konu_sayisi");
$sonuc_sayisi = @mysql_num_rows($sorgu);
// eger $konu_sayisi ndan az konu varsa
if($sonuc_sayisi < $konu_sayisi) {
$sorgu = @mysql_query("SELECT * FROM `".$config['database']['table_prefix']."posts` WHERE `replyto` = '0' ORDER BY `pid` DESC LIMIT 0,$sonuc_sayisi");
}
// sonuclari goster
echo"<h3>Son $konu_sayisi konu</h3>";
while($satir = mysql_fetch_assoc($sorgu)) {
// $satir['subject'] => konu basligi
// $satir['message'] => konu icerigi ama bb_code halinde
echo "> <a href='showthread.php?tid=".$satir['tid']."'>".$satir['subject']."</a><br />\n";
}
?>
<?php
include("inc/config.php");
@mysql_connect($config['database']['hostname'],$config['database']['username'],$config['database']['password']) or die(mysql_error());
@mysql_select_db($config['database']['database']);
// son x konu
$konu_sayisi = '10';
// sorgu
$sorgu = @mysql_query("SELECT * FROM `".$config['database']['table_prefix']."posts` WHERE `replyto` = '0' ORDER BY `pid` DESC LIMIT 0,$konu_sayisi");
$sonuc_sayisi = @mysql_num_rows($sorgu);
// eger $konu_sayisi ndan az konu varsa
if($sonuc_sayisi < $konu_sayisi) {
$sorgu = @mysql_query("SELECT * FROM `".$config['database']['table_prefix']."posts` WHERE `replyto` = '0' ORDER BY `pid` DESC LIMIT 0,$sonuc_sayisi");
}
// sonuclari goster
echo"<h3>Son $konu_sayisi konu</h3>";
while($satir = mysql_fetch_assoc($sorgu)) {
// $satir['subject'] => konu basligi
// $satir['message'] => konu icerigi ama bb_code halinde
echo "> <a href='showthread.php?tid=".$satir['tid']."'>".$satir['subject']."</a><br />\n";
}
?>
this code show only the last 10 threads. but new answers to old thread does not show.