fetch1("select tagname,num,cid from {$dbtbpre}enewstags where tagid='$tagid'"); if(!$tagr['tagname']) { printerror('HaveNotTags','',1); } $tagradd=$empire->fetch1("select * from {$dbtbpre}dp_tagsadd where tagid='$tagid'"); $tagname=$tagr['tagname']; $search.="&tagid=$tagid"; } else { $py=RepPostVar($tag); if(!$py) { printerror('HaveNotTags','',1); } $tagradd=$empire->fetch1("select * from {$dbtbpre}dp_tagsadd where py='$py' limit 1"); if(!$tagradd['tagid']) { $thistagid=(int)$tag; if($thistagid){ $cktr=$empire->fetch1("select tagid,num,tagname,cid from {$dbtbpre}enewstags where tagid='$thistagid' limit 1"); if($cktr['tagid']){ $thispy=htag_ReTagPy('',$cktr['tagname'],$thistagid); $thisadd=$empire->fetch1("select tagid from {$dbtbpre}dp_tagsadd where tagid=$thistagid limit 1"); if($thisadd['tagid']){ $empire->query("update {$dbtbpre}dp_tagsadd set py='$thispy' where tagid=$thistagid limit 1"); }else{ $empire->query("insert into {$dbtbpre}dp_tagsadd(tagid,py) values('$thistagid','$thispy')"); } $thisnewurl=htag_ReWriterTagUrl($thispy,1); header("HTTP/1.1 301 Moved Permanently"); header("location:$thisnewurl[pageurl]"); exit; } } printerror('HaveNotTags','',1); } $tagid=$tagradd['tagid']; $tagr=$empire->fetch1("select tagid,num,tagname,cid from {$dbtbpre}enewstags where tagid='$tagid' limit 1"); if(!$tagr['tagname']) { printerror('HaveNotTags','',1); } $tagname=$tagr['tagname']; } $num=$tagr['num']; $search.="&tag=$tag"; $GLOBALS['navclassid']=0; $classid=$tagr['cid']; $classname=$htag_r[$tagr['cid']]['classname']; //页面参数 $pagetitle=$tagname; $pagekey=$tagradd['bname']; $pagedes=$tagradd['intro']; $classimg=$public_r[newsurl].'e/data/images/notimg.gif'; $url=htag_ReturnTagLinkStr($classid,$classname,$tagid,$tagname); $pageecms=1; $pageclassid=0; $have_class=1; //列表模板 $listtempid=$htag_r['tagstempid']; if($tagradd['tempid']){ $listtempid=$tagradd['tempid']; } elseif($tagr['cid']){ $cadd=$empire->fetch1("select tempid from {$dbtbpre}dp_tagsclassadd where classid=".$tagr['cid']." limit 1"); if($cadd['tempid']){ $listtempid=$cadd['tempid']; } } if(empty($listtempid)) { printerror('ErrorUrl','',1); } $tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewslisttemp")." where tempid='$listtempid'"); if(empty($tempr[tempid])) { printerror('ErrorUrl','',1); } if(empty($mid)) { $mid=$tempr['modid']; } //翻页 $page=intval($page); $start=0; $line=$htag_r['tagslistnum'];//每页显示条数 $page_line=$public_r['listpagelistnum'];//每页显示链接数 $offset=$page*$line;//总偏移量 //系统模型 $ret_r=ReturnReplaceListF($mid); $tidin=''; //总数 if($num){ $num=0; $numsql=$empire->query("select tid,classid,id from {$dbtbpre}enewstagsdata where tagid='$tagid'"); while($numr=$empire->fetch($numsql)){ if(empty($class_r[$numr[classid]][tbname])) { continue; } $ninfor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$numr[classid]][tbname]." where id='$numr[id]' limit 1"); if(empty($ninfor['id'])) { continue; } if($tnum&&$ninfor['tnum']!=$tnum){ continue; } if($tcai&&$ninfor['tcai']!=$tcai){ continue; } if($grade&&$ninfor['grade']!=$grade){ continue; } $tidin.=','.$numr['tid']; $num+=1; } } //显示总数 if($htag_r['maxnum']&&$num>$htag_r['maxnum']){ $num=$htag_r['maxnum']; } $twhere=' and tid<0'; if($tidin){ $tidin=substr($tidin,1); $twhere=" and tid in (".$tidin.") "; } //排序 $addorder="newstime desc"; if($htag_r['tagorder']){ $addorder=$htag_r['tagorder']; } $query="select classid,id from {$dbtbpre}enewstagsdata where tagid='$tagid' ".$twhere.$add; $query.=" order by ".$addorder." limit $offset,$line"; $sql=$empire->query($query); //伪静态 $pagefunr=htag_ReWriterTagUrl($tag); $pagefunr['repagenum']=0; //分页 if($pagefunr['rewrite']==1) { $listpage=InfoUsePage($num,$line,$page_line,$start,$page,$search,$pagefunr); } else { $listpage=page1($num,$line,$page_line,$start,$page,$search); } //页面支持标签 if($public_r['dtcanbq']) { $tempr[temptext]=DtNewsBq('list'.$listtempid,$tempr[temptext],0); } else { if($public_r['searchtempvar']) { $tempr[temptext]=ReplaceTempvar($tempr[temptext]); } } $listtemp=$tempr[temptext]; $rownum=$tempr[rownum]; if(empty($rownum)) {$rownum=1;} $formatdate=$tempr[showdate]; $subnews=$tempr[subnews]; $subtitle=$tempr[subtitle]; $docode=$tempr[docode]; $modid=$tempr[modid]; $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]); //公共 $pageno=''; if($page){ $pageno=$page+1; } $listtemp=str_replace('[!--newsnav--]',$url,$listtemp);//位置导航 $listtemp=Class_ReplaceSvars($listtemp,$url,$pageclassid,$pagetitle,$pagekey,$pagedes,$classimg,$addr,$pageecms); $listtemp=str_replace('[!--page.stats--]','',$listtemp); $listtemp=str_replace('[!--show.page--]',$listpage,$listtemp); $listtemp=str_replace('[!--show.listpage--]',$listpage,$listtemp); $listtemp=str_replace('[!--list.pageno--]',$pageno,$listtemp); //取得列表模板 $list_exp="[!--empirenews.listtemp--]"; $list_r=explode($list_exp,$listtemp); $listtext=$list_r[1]; $no=$offset+1; $changerow=1; while($r=$empire->fetch($sql)) { if(empty($class_r[$r[classid]][tbname])) { continue; } $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]' limit 1"); //替换列表变量 $repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$infor,$ret_r,$docode); $listtext=str_replace("",$repvar,$listtext); $changerow+=1; //超过行数 if($changerow>$rownum) { $changerow=1; $string.=$listtext; $listtext=$list_r[1]; } $no++; } //多余数据 if($changerow<=$rownum&&$listtext<>$list_r[1]) { $string.=$listtext; } if($num==0){ $string='无任何信息'; } $string=$list_r[0].$string.$list_r[2]; echo stripSlashes($string); if($htag_r['open']){ dp_HtmlCache(ob_get_contents(),$cachename); ob_end_flush(); } db_close(); $empire=null; ?>