《CMS技巧:PHPCMS V9评论模块伪静态与TAG模块伪静态设置》要点:
本文介绍了CMS技巧:PHPCMS V9评论模块伪静态与TAG模块伪静态设置,希望对您有用。如果有疑问,可以联系我们。
一、评论模块伪静态设置
{$commentid}_{$page}.html添加完成后记住前面的id号,比如31.
include template('comment','list');
$page = intval($_GET['page']);
$page = max($page,1);
$urlrules = getcache('urlrules','commons');
$urlrule = $urlrules[31];//调用url规则
$pagesize = 10; //分页大小
$comment_db = pc_base::load_model('comment_model');
$comment_data_db = pc_base::load_model('comment_data_model');
$comment = $comment_db->get_one(array('commentid'=>$commentid,'siteid'=>$siteid));
if ($comment){
$comment_data_db->table_name($comment['tableid']);
$comment_info = $comment_data_db->listinfo(Array('commentid'=>$commentid,'status'=>1),'id desc',$page,$pagesize,'','10',$urlrule,Array('commentid'=>$commentid));
$pages = $comment_data_db->pages;
}
3、下面就就改模版了,改模版其实就是改一下那个pc标签,只留下循环那里就可以了,就是把那个调用评论数据的标签改改,删掉这个文件PHPcmstemplatesdefaultcommentlist.html里的:
{pc:comment action="lists" commentid="$commentid" siteid="$siteid" page="$_GET[page]" hot="$hot" num="20"}
和它对应的那个:
{/pc}
然后把循环语句:
{loop $data $r}
改成:
{loop $comment_info $r}
{$pages}
改成:
{str_replace("_0.html","_1.html",$pages)}
RewriteRule ^content_(.*)_([0-9]+).html index.PHP?m=comment&c=index&a=init&commentid=content_$1&page=$2
ok,现在就大功告成了,显示出来的网址是:
/content_9-1-1_2.html
二、TAG模块伪静态设置
{$tag}_{$catid}_{$page}.html 添加完成后记住前面的id号,比如32.
$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',25,'9',Array('catid'=>$catid,'tag'=>urlencode($tag)));
{APP_PATH}index.PHP?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}
改成:
{APP_PATH}{urlencode($keyword)}_{$catid}_1.html