织梦dedecms官方手机站模板使用常见问题总结

1.织梦dedecms自动跳转到wap手机站的方法

织梦dedecms自动跳转到wap手机站的方法很简单,只需在相应的模板中加入以下相应的代码即可:
 
首页模板添加如下带代码:
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobileurl/}/index.php">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO||Nokia|SonyEricsson||Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/index.php";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
列表页/封面页添加如下代码:
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO||Nokia|SonyEricsson||Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
内容页添加如下代码:
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO||Nokia|SonyEricsson||Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
2.织梦dedecms wap手机站给列表页添加两种或多种模板的方法

建立了一个简单的wap手机站,在建站的时候因为PC端的“新闻中心”栏目与“产品中心”栏目是两种模板,可不知道怎么给手机版的“新闻中心”栏目设置一个模板然后再给“产品中心”栏目设置另外一个模板啊?
 
大家都知道在命名时给最后添加 “_m” 就是手机站的模板了,因此尝试将PC端“新闻中心”模板名称“list_news.htm”修改为了“list_news_m.htm”然后再将PC端“产品中心”模板名称“list_pro.htm”修改为了“list_pro_m.htm”,然后再手机端分别打开“新闻中心”和“产品中心”,跳转到了不同的页面!
 
其实手机端网站模板和pc站的是一一对应的。比如您的pc站列表页模板为:list_abc.htm ,那么手机端的模板为list_abc_m.htm,如果手机端的模板没有设置,那么系统会找list_default_m.htm 列表页手机端默认模板。


3.织梦dedecms wap手机站点首页不更新的解决方法

在用织梦dedecms建立wap手机站点的过程中发现,首页一直没有改变,明明把首页模板修改过了为什么不能改变呢?
 
这个问题其实是在更新网站主页html中选择了生成静态,访问手机端m目录的时候,会在m目录下生成index.html文件,手机站路径变为了/m/index.html,每次进行了修改都要把m目录下的index.html文件删除才可以。还有一种办法,将更新网站主页html改为动态浏览,这样的话访问m目录就不会生成html,也会实时更新了。

0 个评论

要回复文章请先登录注册