loadtemplate("main","article_comment.html"); //comment list if(!$_GET["page"])$page=1; else $page = $_GET["page"]; if(!$_GET["lines"])$lines=30; else $lines=$_GET["lines"]; if($_GET["comment"]){ $sql = "select * from ".$tableHead."w_article_comment where aid=".$_GET["comment"]; $string = "?comment=".$_GET["comment"]; $sql1 = "select location,subject from ".$tableHead."w_article where aid = ".$_GET["comment"]; $db->query($sql1); $db->next_record(); $data1 = $db->Record; }elseif($_GET["commentuid"]){ $string = "?commentuid=".$_GET["commentuid"]; $sql = "select w.*,a.subject,a.location from ".$tableHead."w_article_comment w,".$tableHead."w_article a where w.uid = '".$_GET["commentuid"]."' and w.aid = a.aid "; } $db->query($sql); $total = $db->num_rows(); $pages = ceil($total/$lines); $thepage = perpage($pages,$page,$_SERVER["PHP_SELF"].$string); $sql .= " order by postdate desc limit ".$lines * ($page-1).",$lines"; $db->query($sql); $template->set_block("main","commentList","commentLists"); while ($db->next_record()){ $data = $db->Record; $template->set_var(array( 'uid'=>$data["uid"], 'username'=>$data['username'], 'ip'=>$data['ip'], 'content'=>$data['content'], 'uarea'=>$data['subject']?"  对  ".$data['subject']."  发表的评论":"", 'postdate'=>date("Y-m-d h:i:s",$data['postdate']) )); $template->parse('commentLists','commentList',true); } $template->set_var(array( "thepage"=>$thepage, 'commentnum'=>$total, 'subject'=>$data1["subject"]?$data1["subject"]:$data['username']."的评论记录", 'artUrl'=>$data1['location'] )); ?>