帝国CMS默认的tag伪静态方法是tagname方式的,那么怎么实现以tagid来实现tag的伪静态呢?
第一步:修改 e\class\connect.php文件
搜索“function eReturnRewriteTagsUrl($tagid,$tagname,$ecms=0){”找到函数eReturnRewriteTagsUrl,将此函数删除或注释掉,换成下面的代码:
//返回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;
}
第二步:修改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伪静态
按照默认,设置成:tags-[!--tagname--]-[!--page--].html 即可。
第四步:服务器伪静态规则
apache的伪静态规则如下,其它类型服务器请对照此自行修改:
RewriteRule ^tags-(.+?)-(.+?)\.html$ /e/tags/index.php?tagname=$1&page=$2
帝国cms如何在tags列表页获取当前tag的ID方法
在tags列表页获取当前tag的ID方法一:
在动态页面中使用
在tags列表页获取当前tag的ID方法二:
1、编辑etagsindex.php,找到 $listtemp=str_replace('[!--newsnav--]',$url,$listtemp);//位置导航 ,大概在196行左右
2、在下面插入一行:
$listtemp=str_replace('[!--self.classid--]',$tagid,$listtemp);//tagid
3、然后就可以在列表模板里用[!--self.classid--]调用,显示当前tag的id了……
版权与免责声明:
凡注明稿件来源的内容均为转载稿或由网友用户注册发布,本网转载出于传递更多信息的目的;如转载稿涉及版权问题,请作者联系我们,同时对于用户评论等信息,本网并不意味着赞同其观点或证实其内容的真实性;

![英雄棋士团(预下载)?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/yingxiongqishituanyuxiazai.jpg)
![美食小当家?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/meishixiaodangjia.png)
![2047?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/2047.jpg)
![荣誉指挥官(预下载)?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/rongyuzhihuiguanyuxiazai.png)
![繁荣美食市场物语?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/fanrongmeishishichangwuyu.jpg)
![夸克浏览器 v4.2.1.138 好用的手机浏览器?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/kuakezuolanqi.jpg)
![移动办公软件 OfficeSuite Premium v10.18.28716 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/yidongbangongruanjian.jpg)
![乐秀视频编辑器 VideoShow v8.8.4 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/lexiushipinbianjiqi.png)
![X 浏览器 v3.3.9 一款小巧的安卓浏览器?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/x.jpg)
![安卓密码管理软件 Enpass v6.4.5.368 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/anzhuomimaguanliruanjian.jpg)
![差分复制同步 FastCopy-M v3.6.3.51 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/FastCopy3.png)
![多标签页拓展 Clover v3.5.2 Build 19809 精简绿色版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/Clover.png)
![文件重命名 Advanced Renamer v3.85 Lite 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/Advanced_Renamer.png)
![网络防火监控 GlassWire Elite v2.1.166 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/GlassWire.png)
![影音播放器 Daum Potplayer v1.7.20538 美化便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/PotPlayer.png)