MINI_SHL
Current Path : D:/wwwroot/wangmei148/wwwroot/module/
Upload File :
Current File : D:/wwwroot/wangmei148/wwwroot/module/CommentQuery.php

<?php

/*
	[²å¼þÃû³Æ] ÆÀÂÛ¼ìË÷ - Ì滻ģ°æµÄ{#modCommentQuery#}
	[ÊÊÓ÷¶Î§] ÆÀÂÛ¼ìË÷Ò³
	[ÎÄ ¼þ Ãû] CommentQuery.php
	[¸üÐÂʱ¼ä] 2006/8/11
*/


function CommentQuery(){

	global $fsql,$tsql,$charset,$tbl_comment,$PagesInfo,$ShowPages,$MenuInfo;

	
	$PSET=PlusSet("modCommentQuery");
	
	$shownums=PlusDef($PSET["shownums"],"20");
	$ord=PlusDef($PSET["ord"],"uptime");
	$sc=PlusDef($PSET["sc"],"desc");
	$showtime=PlusDef($PSET["showtime"],"m-d H:i");
	$cutword=PlusDef($PSET["cutword"],"0");
	$target=PlusDef($PSET["target"],"_self");
	$tempname=PlusDef($PSET["tempname"],"tpl_comment_query.htm");
	
	$coltype=$_GET["coltype"];
	$nowmenuid=$_GET["nowmenuid"];
	$rid=$_GET["rid"];
	$page=$_GET["page"];


	//Ä£°æ½âÊÍ
	$Temp=LoadTemp(ROOTPATH."templates/".$MenuInfo["skin"]."/".$tempname);
	$TempArr=SplitTblTemp($Temp);

	$str=$TempArr["start"];


	$scl=" fabu='1' and pid='0' ";

	if($coltype!="0" && $coltype!=""){
		$scl.=" and coltype='$coltype' ";

	}

	if($nowmenuid!="" && $nowmenuid!="0"){
		$scl.=" and menuid='$nowmenuid' ";
	}
	if($rid!="" && $rid!="0"){
		$scl.=" and rid='$rid' ";
	}

	
	
	include(ROOTPATH."includes/func/memberpages.inc.php");
	$pages=new pages;

	$totalnums=TblCount($tbl_comment,"id",$scl);
	
	$pages->setvar(array("nowmenuid" => $nowmenuid,"rid" => $rid,"coltype" => $coltype));

	$pages->set($shownums,$totalnums);		                          
		
	$pagelimit=$pages->limit();	  

	$fsql->query("select * from $tbl_comment where $scl order by $ord $sc limit $pagelimit");

	while($fsql->next_record()){
		
			$id=$fsql->f('id');
			$rid=$fsql->f('rid');
			$title=$fsql->f('title');
			$menuid=$fsql->f('menuid');
			$dtime=$fsql->f('uptime');
			$author=$fsql->f('name');
			$cl=$fsql->f('cl');
			$lastname=$fsql->f('lastname');
			$face=$fsql->f("face");


			$tsql->query("select count(id) from $tbl_comment where pid='$id' and fabu='1'");
			if($tsql->next_record()){
				$count=$tsql->f('count(id)');
			}
		$face=ROOTPATH."face/".$face.".gif";

		$dtime=date($showtime,$dtime);
		if($cutword!="0"){$title=csubstr($title,0,$cutword,$charset);}
		$link=ROOTPATH."comment_detail.php?commentid=$id";


			$var=array (
			'title' => $title, 
			'dtime' => $dtime, 
			'author' => $author, 
			'count' => $count, 
			'cl' => $cl, 
			'link' => $link,
			'lastname' => $lastname,
			'face' => $face, 
			'target' => $target
			);

		$str.=$TempArr["rowstart"];
		$str.=ShowTplTemp($TempArr["list"],$var);
		$str.=$TempArr["rowend"];
		

		

	}

	$str.=$TempArr["end"];

	$PagesInfo=$pages->ShowNow();
	$ShowPages=$pages->output(1);


	return $str;


}
?>