loadtemplate("main","singlepage_newscontent.html"); elseif($_GET["news"]) $template->loadtemplate("main","singlepage_news.html"); else $template->loadtemplate("main","singlepage.html"); //À¸Ä¿ÄÚÈÝ $sql = "select * from ".$tableHead."w_singlepage where sgid = ".$_GET["id"]; $db->query($sql); $db->next_record(); $data1 = $db->Record; //$template->set_var(array( //'pageName'=>$data["name"], //'pageContent'=>$data["content"], //'name'=>$data["name"] //)); $topid = $data1["fid"] != 0?$data1["fid"]:$_GET["id"]; //sort list $sql = "select * from ".$tableHead."w_singlepage where fid = ".$topid." order by squence"; $db->query($sql); $template->set_block("main","sglist","sglists"); $i = 0; while ($db->next_record()){ $BData = $db->Record; if($i == 0) $template->set_var(array( 'sname'=>$BData["name"], 'sid'=>$BData["sgid"], 'pageContent'=>$BData["content"], 'name'=>$BData["name"] )); else $template->set_var(array( 'sname'=>$BData["name"], 'sid'=>$BData["sgid"] )); $i++; $template->parse("sglists","sglist",true); } if($_GET["news"]){ //news list if(!$_GET["page"])$page=1; else $page = $_GET["page"]; if(!$_GET["lines"])$lines=30; else $lines=$_GET["lines"]; $sql = "select aid,subject,postDate from ".$tableHead."w_article where fcid = 67 or cid = 67"; $string = "?id=1&news=1"; $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","NewsList","NewsLists"); while ($db->next_record()){ $data = $db->Record; $template->set_var(array( 'nid'=>$data["aid"], 'subject'=>$data['subject'], 'postdate'=>date("Y-m-d",$data["postDate"]) )); $template->parse('NewsLists','NewsList',true); } $template->set_var(array( "thepage"=>$thepage, 'fname'=>$data1["name"])); } elseif($_GET["nid"]){ $sql = "select aid,subject,content from ".$tableHead."w_article where aid = ".$_GET["nid"]; $db->query($sql); $db->next_record(); $data = $db->Record; $template->set_var(array( 'content'=>$data["content"], 'subject'=>$data['subject'], 'fname'=>$data1["name"] )); } elseif($topid != $_GET["id"]){ $sql = "select * from ".$tableHead."w_singlepage where sgid = ".$topid; $db->query($sql); $db->next_record(); $data2 = $db->Record; $template->set_var(array( 'pageContent'=>$data1["content"], 'fname'=>$data2["name"], 'name'=>$data1["name"] )); } else $template->set_var(array( 'fname'=>$data1["name"] )); require($path."include/global_end.inc.php"); ?>