1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > PHPCMS V9网站管理系统内容页评述模块伪静态的实现

PHPCMS V9网站管理系统内容页评述模块伪静态的实现

时间:2022-07-07 04:01:22

相关推荐

PHPCMS V9网站管理系统内容页评述模块伪静态的实现

后端开发|php教程

nbsp,comment,commentid,html,page

后端开发-php教程

PHPCMS V9网站管理系统内容页评论模块伪静态的实现

PHPCMS V9评论伪静态是建立在listinfo支持伪静态规则的基础上才能实现的,所以我们只要熟练学习操作熟练使用listinfo,就能在phpcms的任何页面实现伪静态分页了,下面我们就开始逐步讲解PHPCM V9网站管理系统内容页的评论伪静态的详细实现方法。

A、评论模块伪静态设置

有什么免费源码网站吗,ubuntu更改输入中文,西双版纳爬虫味道,php入门教程45讲技术交流,黄骅seo服务lzw

1、首先在后台->扩展->url规则里添加一个新的规则用于评论模块,如下面所示:

传奇登录器源码,vscode固定横滚动条,ubuntu办公电脑,tomcat端口冲突修改,python指令爬虫,php表单怎么写,海南抖音seo获客系统,竖排导航网站lzw

{$commentid}_{$page}.html添加完成后记住前面的id号,比如31。

asp留言板源码,ubuntu怎么显示图标,tomcat服务ip前图标,connect连接 爬虫,Php复杂查询 service,麻涌seo关键词优化费用lzw

2、本来PC标签支持urlrule呢,后来不支持了,只好改代码了,于是打开文件phpcms/modules/comment/index.php找到:

include template(‘comment’, ‘list’); 在它上面添加几行用于读取urlrule和从评论表中调用评论数据,对了,评论表是带分表的。

$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” hot=”$hot” num=”20″}

和它对应的那个:

{/pc}

然后把循环语句:

{loop $data $r}

改成:

{loop $comment_info $r}

把分页标签:

{$pages}

改成:

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

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

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

B、TAG模块伪静态设置

1、在后台->扩展->url规则里添加一个新的规则用于评论模块,如下面所示:

{$tag}_{$catid}_{$page}.html 添加完成后记住前面的id号,比如32。

2、打开phpcms/modules/content/tag.php文件,找到:

$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)));

//www.software8.co

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的任何页面实现伪静态分页了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。