织梦dedecms配置手机wap站点并绑定二级域名

织梦dedecms配置手机wap站点并绑定二级域名,第1张

织梦dedecms配置手机wap站点并绑定二级域名

Dreamweavercmsdedecms如何配置手机wap网站并关联二级域名?这里有一个很好的例子,供大家参考。

域名手机网站wap.abc.com

1.安裝手机wap访问控制模块

2.网站根目录建立wap文件夹,将templets\wap文档移入根目录下的wap,如图所示: 
 

3.将根目录下的wap.php移入wap文件夹,如图所示:

4.修改wap.php

a.第一行require_once(dirname(__FILE__)."/include/common.inc.php");修改成require_once(dirname(__FILE__)."/../include/common.inc.php");

b.第四行require_once(dirname(__FILE__)."/include/wap.inc.php");修改成require_once(dirname(__FILE__)."/../include/wap.inc.php");

c.第六行$cfg_templets_dir=$cfg_basedir.$cfg_templets_dir;修改成$cfg_templets_dir=$cfg_basedir."/wap/".$cfg_templets_dir;

d.找到require_once(dirname(__FILE__)."/include/datalistcp.class.php");修改成require_once(dirname(__FILE__)."/../include/datalistcp.class.php");

5.文章内容含有照片处理,寻找include/wap.inc.php

第54行$content=str_replace("WAP-IMG::{$k}",$attstr,$content);修改成$content=str_replace("WAP-IMG::{$k}",“”,$content);

假如期待让照片显示信息,您能够修改这个图片途径

6.IIS设定

a.下的wap文件夹做跳转

b.建立新网站wap.abc.com关联文件夹wap

7.手机上浏览立即自动跳转wap.abc.com

模板index.htm加上js

<scriptsrc="/tz.php"type="text/javascript"></script>

tz.php编码:

复制代码编码以下:
<?phpif(isset($_SERVER['HTTP_USER_AGENT'])){$clientkeywords=array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');//从HTTP_USER_AGENT中搜索浏览器的关键词if(preg_match("/(".implode('|',$clientkeywords).")/i",strtolower($_SERVER['HTTP_USER_AGENT']))){?><?phpif(isset($_SERVER['HTTP_USER_AGENT'])){$clientkeywords=array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');//从HTTP_USER_AGENT中搜索浏览器的关键词if(preg_match("/(".implode('|',$clientkeywords).")/i",strtolower($_SERVER['HTTP_USER_AGENT']))){?>window.location.href='';<?PHP}}?>

8.wap站加上检索

修改wap.php

复制代码编码以下:
elseif($action=='search'){$needCode='UTF-8';if(empty($keyword))exit('Error!');require_once(dirname(__FILE__)."/../include/datalistcp.class.php");$varlist="cfg_webname,cfg_templeturl";ConvertCharset($varlist);$dlist=newDataListCP();$dlist->SetTemplet($cfg_templets_dir."/wap/search.wml");$dlist->pageSize=10;$dlist->SetParameter("action","search");$dlist->SetParameter("keyword",$keyword);$dlist->SetSource("Selectid,title,pubdate,clickFrom`idea_archives`wheretitlelike'%".iconv("UTF-8","GB2312",$keyword)."%'Andarcrank=0orderbyiddesc");$dlist->Display();exit();}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/773374.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存