Topic: portalnews instead of forum id i want to pull cat id
i want to be able to pull the categories and the subjects of the lastest post to my frontpage.
http://bunpai.com
this is the code i use for my frontpage mod.
<?php
$newsid = '4'; // Forum id to fetch the news from ( only supports 1 forum id )
$newsdisplay = '5'; // Number of news to display.
?>
<?php
require_once PUN_ROOT.'include/parser.php';
?>
<?
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?
echo "\t\t\t\t\t\t\t".' <h2><span>'.pun_htmlspecialchars($cur_post['subject']).'</span></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<p>
<ul>
<?php echo $cur_post['message']."\n" ?><br />
<?
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'."\n";
?>
</ul>
</p>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
</p>
My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!
Don't be stupid and help ! We are the stupid one's !!!