sort.php
资源名称:BBWPS.rar [点击查看]
上传用户:yttaitong
上传日期:2009-05-10
资源大小:128k
文件大小:6k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
PHP
- <?
- /*
- [BBWPS!] (C)2006-2010 小蜜蜂版权所有.
- This is NOT a freeware, use is subject to license terms
- 时间:2007年12月
- 描述:信息分类显示列表
- */
- $sid = $_GET['sid'];
- $parseTemplateName="sort.html";
- $p->set_file("handle","sort.html");
- $p->set_var("city_id",$cid.".html");
- //*******导航条**********
- $sql1 = $db->query("select a.sid,a.sname from ".$prefix."sort as a join ".$prefix."sort as b on
- a.sid=b.sparent where b.sid='".$sid."'",1);
- $result1 = $db->fetch_array($sql1);
- $onesort = $result1["sname"];
- $sql2 = $db->query("select sname from ".$prefix."sort where sid='".$sid."'",1);
- $result2 = $db->fetch_array($sql2);
- $twosort = $result2["sname"];
- if($onesort){
- $o_sort = " <a href=?f-sort--sid-".$result1["sid"]."--cid-".$cid.".html>".$onesort."</a>";
- $p->set_var("sort1",$o_sort);
- $t_sort = " $twosort";
- $p->set_var("sort2",$t_sort);
- }
- else{
- $t_sort = " <a href=?f-sort--sid-".$sid."--cid-".$cid.".html>".$twosort."</a>";
- $p->set_var("sort1",$t_sort);
- }
- unset($o_sort,$t_sort);
- //***********一级分类更新信息列表************
- $p->set_block("handle","onesort","os");
- $p->set_block("handle","twosort","tp");
- if(!$onesort){
- //*************二级分类列表**************
- $two_sort = "select sname,sid from ".$prefix."sort where sparent='".$sid."'";
- $tsort = $db->query($two_sort,1);
- $p->set_block("onesort","xp","x");
- while($out = $db->fetch_array($tsort)){
- $p->set_var($out);
- $p->set_var("city_id",$cid.".html");
- $p->parse("x","xp",true);
- }
- $sql3 = "select * from ".$prefix."message left join ".$prefix."sort on ".$prefix."sort.sid = ".$prefix."message.sid
- left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid where ( ".$prefix."sort.sid='".$sid."' or ".$prefix."sort.sparent='".$sid."')
- and ( ".$prefix."city.cid='".$cid."' or ".$prefix."city.cparent='".$cid."' ) and ".$prefix."message.etime > '".time()."' limit 0,$s_u_pagesize";
- $osql = $db->query($sql3,1);
- $p->set_block("onesort","ap","a");
- while($oresult = $db->fetch_array($osql)){
- $p->set_var($oresult);
- $p->set_var("city_id",$cid.".html");
- $p->parse("a","ap",true);
- }
- $p->parse("os","onesort",true);
- }
- //*************二级分类更新信息列表**************
- else{
- $samesort = "select sname,sid from ".$prefix."sort where sparent = '".$result1["sid"]."' ";
- $ssort = $db->query($samesort,1);
- $p->set_block("twosort","yp","y");
- while($output = $db->fetch_array($ssort)){
- if($sid==$output["sid"]){
- $p->set_var("self",$output["sname"]);}
- else{
- $p->set_var($output);
- $p->set_var("city_id",$cid.".html");
- $p->parse("y","yp",true);
- }
- }
- $sql4 = "select * from ".$prefix."message left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid
- where ".$prefix."message.sid='".$sid."' and ( ".$prefix."city.cid='$cid' or ".$prefix."city.cparent='$cid' ) and ".$prefix."message.etime > '".time()."' limit 0,$s_u_pagesize";
- $tsql = $db->query($sql4,1);
- $p->set_block("twosort","bp","b");
- while($tresult = $db->fetch_array($tsql)){
- $p->set_var($tresult);
- $p->set_var("city_id",$cid.".html");
- $p->parse("b","bp",true);
- }
- $p->parse("tp","twosort",true);
- }
- //*************一级分类信息列表**************
- $p->set_block("handle","cp","c");
- $p->set_block("handle","dp","d");
- if(!$onesort){
- $sql5 = "select * from ".$prefix."message left join ".$prefix."sort on ".$prefix."sort.sid = ".$prefix."message.sid
- left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid where ( ".$prefix."sort.sid='".$sid."' or ".$prefix."sort.sparent='".$sid."') and ( ".$prefix."city.cid='".$cid."' or ".$prefix."city.cparent='".$cid."' )
- and ".$prefix."message.etime > '".time()."' limit $start,$pagesize";
- $sqlo = $db->query($sql5,1);
- while($resulto = $db->fetch_array($sqlo)){
- $p->set_var($resulto);
- $p->set_var(array("city_id"=> $cid.".html","time"=>date("Y-m-j",$resulto["btime"])));
- $p->parse("c","cp",true);
- }
- $number1 = $db->query("select count(".$prefix."message.mid) from ".$prefix."message left join ".$prefix."sort on ".$prefix."sort.sid = ".$prefix."message.sid
- left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid where ( ".$prefix."sort.sid='".$sid."' or ".$prefix."sort.sparent='".$sid."')
- and ( ".$prefix."city.cid='".$cid."' or ".$prefix."city.cparent='".$cid."' ) and ".$prefix."message.etime > '".time()."'",1); //一级分类信息总条数?
- $num1 = $db->fetch_array($number1);
- $total = $num1["count(".$prefix."message.mid)"];
- $query = "f-sort--sid-".$sid."--cid-".$cid;
- $p->set_var("fenye1",showpage($total,$pagesize,$page,$query));
- }
- //**************二级分类信息列表***************
- else{
- $sql6 = "select * from ".$prefix."message left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid where ".$prefix."message.sid='".$sid."' and
- ( ".$prefix."city.cid='$cid' or ".$prefix."city.cparent='$cid' ) and ".$prefix."message.etime > '".time()."' limit $start,$pagesize";
- $sqlt = $db->query($sql6,1);
- while($resultt = $db->fetch_array($sqlt)){
- $p->set_var($resultt);
- $p->set_var(array("city_id"=> $cid.".html","time"=>date("Y-m-j",$resultt["btime"])));
- $p->parse("d","dp",true);
- }
- $number2 = $db->query("select count(".$prefix."message.mid) from ".$prefix."message left join ".$prefix."city on ".$prefix."message.cid=".$prefix."city.cid
- where ".$prefix."message.sid='".$sid."' and ( ".$prefix."city.cid='".$cid."' or ".$prefix."city.cparent='".$cid."' ) and ".$prefix."message.etime > '".time()."'",1); //二级分类信息总条数
- $num2 = $db->fetch_array($number2);
- $total = $num2["count(".$prefix."message.mid)"];
- $query = "f-sort--sid-".$sid."--cid-".$cid;
- $p->set_var("fenye2",showpage($total,$pagesize,$page,$query));
- }
- ?>