首页 > CMS建站 > PhpCMS > 正文

PHPCMS V9 WAP手机站伪静态的实现方法

2020-07-03 12:58:26
字体:
来源:转载
供稿:网友
这篇文章主要为大家详细介绍了PHPCMS V9 WAP手机站伪静态的实现方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。

本文主要由讲解下PHPCMS V9 WAP手机站伪静态的实现方法,闲话不多说了直接上修改方法。

本文是由361源码转自网络,本文方法观点不代表361源码观点

1、打开 /phpcms/modules/wap/functions/global.func.php 文件

找到

return WAP_SITEURL."&a=lists&typeid=$typeid";

修改为

return "/list-$typeid".'.html';

继续找到

return WAP_SITEURL."&a=show&catid=$catid&typeid=$typeid&id=$id";

修改为

return "/show-$catid-$typeid-$id".'.html';


2、打开 /phpcms/modules/wap/index.php 文件

找到

define('URLRULE', 'index.php?m=wap&c=index&a=lists&typeid={$typeid}~index.php?m=wap&c=index&a=lists&typeid={$typeid}&page={$page}');

修改为

define('URLRULE', 'list-{$typeid}.html~list-{$typeid}-{$page}.html');

3、打开 /phpcms/modules/wap/classes/wap_url.class.php 文件

找到

$urlrules = 'c=index&a=show&catid={$catid}&typeid={$typeid}&id={$id}|c=index&a=show&catid={$catid}&typeid={$typeid}&id={$id}&page={$page}';

修改为

$urlrules = 'show-{$catid}-{$typeid}-{$id}.html|show-{$catid}-{$typeid}-{$id}-{$page}.html';

继续找到

if($laststr=='?'){$url_arr[0] = $url_arr[1] = WAP_SITEURL.$urls;}else{$url_arr[0] = $url_arr[1] = WAP_SITEURL.'&'.$urls;}

WAP_SITEURL 修改为你自己的网址, 如本站修改示例 http://m.xxx.com

if($laststr=='?'){$url_arr[0] = $url_arr[1] = "http://m.xxx.com/".$urls;}else{$url_arr[0] = $url_arr[1] = "http://m.xxx.com/".'&'.$urls;}

4、模板调用

<a href='http://m.xxx.com/show-{$catid}-{$typeid}-{$previous_page[id]}.html' class='cuoxin.com'>上一篇</a><a href='http://m.xxx.com/show-{$catid}-{$typeid}-{$next_page[id]}.html' class='www.cuoxin.com'>下一篇</a>

“phpcms v9 wap手机门户站点内容页添加上一篇、下一篇的方法” 来实现的上一篇下一篇功能,故将此文章链接贴于此处,有需要的可以看下。

上一篇、下一篇方法介绍:

PHP源码修改:

打开 phpcms/modules/wap/index.php 文件

找到

if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');

在其下面添加

//上一篇$previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC');//下一篇$next_page = $this->db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99");//当前页为第一篇时:再点击上一篇仍然显示第一篇if(empty($previous_page)) {$previous_page = $this->db->get_one("`catid` = '$catid' AND `id`='$id' AND `status`=99",'*','id DESC');}//当前页为最后一篇时:再点击下一篇仍然显示最后一篇if(empty($next_page)) {$next_page = $this->db->get_one("`catid`= '$catid' AND `id`='$id' AND `status`=99");}

模板调用:

<a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid={$typeid}&id={$previous_page[id]}" title="www.cuoxin.com">上一篇:{$previous_page[title]}</a><a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid={$typeid}&id={$next_page[id]}" title="www.cuoxin.com">下一篇:{$next_page[title]}</a>

5、添加伪静态规则

RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?&a=lists&typeid=$1&page=$2

RewriteRule ^list-([0-9]+).html index.php?&a=lists&typeid=$1;

RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html index.php?a=show&catid=$1&typeid=$2&id=$3&page=$4;

RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?a=show&catid=$1&typeid=$2&id=$3;

完成

以上就是PHPCMS V9 WAP手机站伪静态的实现方法的全部内容,希望对大家的学习和解决疑问有所帮助,也希望大家多多支持错新网。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表