теми от категория

kitchenbg

Registered
здравейте, знам че има такива уроци за последни теми от форум, но как да го направя да взема само от определена категория?
 
за phpbb2: http://web-tourist.net/login/login/view.php?st=1720

Трябваше да уточниш коя система ползваш , а не да научквам :)
 
ето това
Код:
<?php
$max = "100";
$maxs = "25";
$address = ""; //
$host = ""; //db host, localhost?
$user = ""; //db user
$pass = ""; //db secret
$db = ""; //forum database

$show = "10"; //number of posts to show
$link = mysql_pconnect($host, $user, $pass) or die('Error connecting to mysql host!');
$db = mysql_select_db($db) or die('Error selecting database!');

$query = "SELECT DISTINCT u.username,t.topic_id,t.topic_title, x.post_text FROM phpbb_categories c,phpbb_users u,phpbb_topics t, phpbb_posts p, phpbb_posts_text x WHERE t.topic_poster = u.user_id and t.topic_id = p.topic_id and t.topic_first_post_id = x.post_id order by  t.topic_last_post_id desc limit 0,$show";
$result = mysql_query($query, $link) or die(mysql_error());

while ($row=mysql_fetch_array($result))
{
if (strlen($row[post_text])>$max)
{$thedots='...';}
else
{$thedots='';}
$text= substr($row[post_text],0 , $max);

if (strlen($row[topic_title])>$maxs)
{$thedotss='...';}
else
{$thedotss='';}
$texts= substr($row[topic_title],0 , $maxs);

$text = nl2br($text);
$text = preg_replace('/\s\s+/', ' ', $text);

$texts = nl2br($texts);
$texts = preg_replace('/\s\s+/', ' ', $texts);

$title = $row[topic_title];

echo ("<img src=\"../../images/arrow_right.gif\" width=\"9\" height=\"9\" align=\"absmiddle\">    <a href='$address/viewtopic.php?t=$row[topic_id]' title=\"$title\" target=_blank>$texts$thedotss</a><br/>\n");

}
?>
 

Back
Горе