<?php
/* Copyright (c) 2001-02 by Ken Williams (hide@address.com)*/
/* http://phpfastnews.sourceforge.net/ & http://www.phpfastnews.com*/
/* */
/* You can redistribute and/or modify the following code under the */
/* terms of the GNU General Public License as published by the */
/* the Free Software Foundation. */
/* */
/* All code by Ken Williams (HDwebdev) unless otherwise noted */
/* This is an alpha test release -- not intended for live site use */
$pg = "news_index";
$tpl = "news.tpl";
require('Lib/prependphpfn.php');
$r->set_block('TPL','NEWS_INDEX');
if ($startrecord == '') { $startrecord = 0; }
$query = "select body, subject, handle, replies, n_cdate, news_id from fn_news,fn_user
where user_id2 = user_idfk order by n_cdate desc limit $startrecord, $numrecords";
$db->query($query);
$count = 0;
while ($db->next_record()) {
$count++;
$replies = $db->f('replies');
$news_id = $db->f('news_id');
$r->set_var(array(
'BODY' => $db->f('body'),
'SUBJECT' => $db->f('subject'),
'POSTEDBY' => $db->f('handle'),
'POSTCOUNT' => $replies,
'DATETIME' => $ndate($db->f('n_cdate')),
'lnkREPLY' => "<a href=news_reply.php?r_id=" . $news_id . ">Reply</a>"
));
if ($replies) {
$r->set_var('lnkREPLIES' , "<a href=news_view.php?r_id=" . $news_id . ">" . $replies . " Comments</a>");
}
//random banner code <-- will be replaced with generic $do->stuff() type function
//if(!$x) {
//$ralph = $sideblocks->threeup();
//$r->set_var('banner',$ralph);
//}
//end random banner code
$r->parse('body','NEWS_INDEX',true);
//banner stuff again
//$r->set_var('banner','');
//$x=1;
//end banner stuff again
$r->set_var('lnkREPLIES',''); // <-- keep this to stop Bad Things from happening
}
// Cheesy previous/next link (for now) need to change it to a more efficient one
//if ($startrecord) {
// $centerfooter .= "[<a href=news_index.php?startrecord=" . ($startrecord - $numrecords) . ">PREVIOUS</a>] ";
// }
//
//if ($count == $numrecords) { $centerfooter .= "[<a href=news_index.php?startrecord=" . ($startrecord + $numrecords) . ">NEXT</a>]"; }
//
$r->set_var('CENTERFOOTER',$centerfooter);
//$r->parse('body','NEWS_INDEX',true);
require('Lib/appendphpfn.php');
?>