A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > dedecms > 织梦教程:电脑站首页内页链接手机访问自动跳转对应手机站首页内页连

织梦教程:电脑站首页内页链接手机访问自动跳转对应手机站首页内页连

时间:2015-09-25 16:33作者:fang人气:958

移动互联网时代的到来,让传统企业渐渐有了搭建手机站的意识,本文就不说如何搭建手机站了,搭建

手机站和电脑站原理差不多,但是如何才能让电脑站的链接手机访问时,一一对应起来呢?FK模板中心

仅以织梦网站为例,讲解一下电脑站和手机站链接一一对应的方法。

以下代码是百度官方给出的跳转代码,将此段代码放在电脑站首页,假如网站网址为www.moke8.com,当

手机站访问时,会自动跳转到手机站www.moke8.com/wap

<script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js"

type="text/javascript"></script>

<script type="text/javascript">uaredirect("/wap");</script>

那么问题来了,如果手机访问电脑站的内页呢?总不能都跳转到手机站的首页去吧?如何才能对应跳转

到手机站的内页?熟悉织梦的朋友应该都知道织梦有调用栏目链接和文章链接的标签,那么我们可以灵活运用到这段代码里。

栏目列表页对应跳转代码:

<script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js" type="text/javascript"></script>

<script type="text/javascript">uaredirect("/wap{dede:type typeid=''}[field:typeurl/]{/dede:type}");</script>

文章页对应跳转代码:

<script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js" type="text/javascript"></script>

<script type="text/javascript">uaredirect("/wap{dede:field name='arcurl'/}");</script>

只需将以上三段代码放置相应的模板里即可实现电脑站首页内页链接手机访问自动跳转对应手机站首页内页连接。

希望对你们有所帮助

标签织梦,教程,电脑,首页,内页,链接,手机,访问,自动,跳转

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

公众号