Location: PHPKode > projects > Phpfastnews > phpfastnews/forum_index.php
<?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 = "forum_index";
$tpl = "forum.tpl";
require('Lib/prependphpfn.php');

$r->set_block('TPL','FORUM_INDEX');
$r->set_block('FORUM_INDEX', 'CATEGORYLOOP', 'outerblock');
$r->set_block('CATEGORYLOOP', 'SHOWFORUMS', 'innerblock');

$db2 = newObject('Core::psDb');
$query= "select * from fn_ftopics";

$db2->query($query);

while ($db2->next_record()) {

	$topic_id = $db2->f("topic_id");
	$query = "select * from fn_forum,fn_ftopics where (topic_id = topic_idfk) and (topic_id = '$topic_id')";
	$db->query($query);
// CLEAR INNERBLOCK WHEN LOOPING
	$r->set_var('innerblock','');
	while ($db->next_record()){
		$r->set_var(array(
			"thFORUMS" => "FORUMS",
			"thTOPICS"=>"TOPICS",
			"thPOSTSCOUNT" => "POSTS",
			"thLATESTPOST"=>"LATEST BY",
			"thMODERATORS" => "MODERATORS",
			"FORUMCATEGORY" =>$db->f("name"),
			"NEWOLD" => "newold",
			"SECTIONNAME" =>"<a href=forum_view.php?f_id=" . $db->f('forum_id') . ">" . $db->f("ff_name") . "</a>",
			"SECTIONDESC" => $db->f("ff_description"),
			"TOPICS"=> $db->f("subjects"),
			"POSTS" => $db->f("posts"),
			"MODERATORS"=>"moderators",
			"SUBJECT" =>$db->f("f_lastsubj"),
			"DATETIME"=>$ndate($db->f("f_ldate")),
			"USERNAME"=>$db->f("f_luser")
			));
		if(!$db->f("f_ldate")) {
		$r->set_var(array(
			"DATETIME"=> '',
			"USERNAME"=> '(No Posts)' 
			));
		}

                $r->parse('innerblock', 'SHOWFORUMS',true);

	}
	$r->parse('outerblock', 'CATEGORYLOOP',true);
}
$r->parse('body','FORUM_INDEX',true);

require('Lib/appendphpfn.php');
?>
Return current item: Phpfastnews