PHPCMS V9评论模块伪静态与TAG模块伪静态设置

2019-02-15 14:04:19丽君



$total = $this->db->number;

这一行往上面添加以下代码:


$siteid = $this->categorys[$catid]['siteid'];
$siteurl = siteurl($siteid);
$this->db->set_model($modelid);
$page = $_GET['page'];
$urlrules = getcache('urlrules','commons');
$urlrule = $urlrules[32];//调用url规则
$datas = $infos = array();
$infos = $this->db->listinfo("`keywords` LIKE '%$tag%'",'id DESC',$page,25,'','9',$urlrule,Array('catid'=>$catid,'tag'=>urlencode($tag)));

3、修改模板,打开phpcmstemplatesdefaultcontentshow.html,找到:


{APP_PATH}index.php?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}

改成:


{APP_PATH}{urlencode($keyword)}_{$catid}_1.html

打开phpcmstemplatesdefaultcontenttag.html,把分页标签:


{$pages}

改成:


{str_replace("_0.html","_1.html",$pages)}

4、在.htaccess文件里加入以下代码:


RewriteRule ^(.*)_([0-9]+)_([0-9]+).html index.php?m=content&c=tag&catid=$2&tag=$1&page=$3

最后显示出来的URL样式如下:
/关键词_6_1.html
小结:其实以上的修改都是在listinfo支持伪静态规则的基础上来修改的,熟练使用listinfo,就能在phpcms的任何页面实现伪静态分页了。