时间:2023-04-23 23:36:01 | 来源:网站运营
时间:2023-04-23 23:36:01 来源:网站运营
帝国CMS tagsid伪静态实现方法(简单实用)://返回TAGS列表伪静态function eReturnRewriteTagsUrl($tagid,$tagname,$ecms=0){ global $public_r,$empire,$dbtbpre; if(!$tagid){ $tagname=RepPostVar($tagname); if(!$tagname) { $r['pageurl']=$public_r['newsurl']; $r['rewrite']=0; return $r; } $tagr=$empire->fetch1("select tagid,num from {$dbtbpre}enewstags where tagname='$tagname' limit 1"); if(!$tagr['tagid']) { $r['pageurl']=$public_r['newsurl']; $r['rewrite']=0; return $r; } $tagid=$tagr['tagid']; } if(empty($public_r['rewritetags'])) { $r['pageurl']=$public_r['newsurl']."e/tags/?tagid=".$tagid; $r['rewrite']=0; } else { if($ecms==1) { $r['pageurl']=$public_r['newsurl'].str_replace(array('[!--tagname--]','[!--page--]'),array($tagid,0),$public_r['rewritetags']); } else { $r['pageurl']=$public_r['newsurl'].str_replace('[!--tagname--]',$tagid,$public_r['rewritetags']); } $r['rewrite']=1; } return $r;}
第二步:修改TAG支持文件 e/tags/index.php文件/*if($tagr['tagid']&&empty($add)&&$search=='&tagname='.$tagname.'&line='.$public_r['tagslistnum'].'&tempid='.$public_r['tagstempid']){*/ //伪静态 $pagefunr=eReturnRewriteTagsUrl($tagid,$tagname,0); $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); }/*}else{ $listpage=page1($num,$line,$page_line,$start,$page,$search);//分页}*/
第三步:后台设置tag伪静态RewriteRule ^tags-(.*)-(.*)$ e/tags/index.php?tagid=$1&page=$2Nginx的伪静态规则:rewrite ^/tags-(.*)-(.*)$ /e/tags/index.php?tagid=$1&page=$2;
关键词:方法,简单,实用,实现,静态,帝国