08
2018
11

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

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

本文也主要以假设的移动端网站 m.XXXXX.com 为示例讲解。

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.XXXXX.com

if($laststr=='?'){

$url_arr[0] = $url_arr[1] = "http://m.XXXXX.com/".$urls;

}else{

$url_arr[0] = $url_arr[1] = "http://m.XXXXX.com/".'&'.$urls;

}    

4、模板调用

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

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

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

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;

原文链接:https://www.qiquanji.com/post/7313.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。