this is a mini new system that i used on one of my sites...
http://bunpai.com
take this code and place it anywhere you want the news item to showup...
what i did was create a folder called user under include
include/user
i named this portalnews.php
so it is like this include/user/portalnews.php
then i placed this code in the main.tpl where i want the item to show up
<div id="right">
<div class="leftcol">
<p><pun_include "portalnews.php"></p>
<p></p>
</div>
<?php
$newsid = '1'; // 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']);
?>
<?
echo "\t\t\t\t\t\t\t".' <h2><span>'.pun_htmlspecialchars($cur_post['subject']).'</span></h2>'."\n";
?>
<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";
?>
<div style="text-align: right">
<?
echo "\t\t\t\t\t\t\t".'<p class="date">Posted by: <a style="text-decoration: none" href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> <a href="about.php"> | Read more</a> <img src="images/comment.gif" alt="" /> '.pun_htmlspecialchars($lang_portal['Comments']).': '.pun_htmlspecialchars($cur_post['num_replies']).' <a href="#">Comments (3)</a> <img src="images/timeicon.gif" alt="" /> '.pun_htmlspecialchars($lang_portal['Views']).': '.pun_htmlspecialchars($cur_post['num_views']).'</span></p><br />'."\n";
?>
</div>
</ul>
<?
}
}
else
{
}
?>
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 !!!