国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 帝國Empire > 正文

帝國cms電腦pc站url跳轉到手機站url的方法

2024-08-28 12:23:07
字體:
來源:轉載
供稿:網友

 本文講解一下帝國cms電腦網站跳轉到手機動態網站和手機靜態網站的方法。

方法一:帝國pc站跳轉到手機靜態站

1、假設我們有帝國cms 電腦網站www.lazybirdfly.com ,手機網站m.lazybirdfly.com ,手機網站使用帝國cms的多訪問端功能制作,如果不了解帝國cms多訪問端制作手機網站的方法,請參考:http://www.lazybirdfly.com/a/ecms/658.html

現在電腦端和手機端都是生成靜態網站,除了域名不同,靜態連接地址都是相同的,例如:
www.lazybirdfly.com/china/1.html 對應 m.lazybirdfly.com/china/1.html

2、接下來要給電腦網站的首頁、列表頁、內容頁的模板添加跳轉代碼,方法如下:

js是瀏覽器跳轉,meta是告訴搜索引擎移動頁面的地址。

(1)首頁模板需添加下面代碼
<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com/";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com/">   

(2)封面頁和列表頁添加下面代碼

<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>">   

(3)內容頁添加下面代碼

<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com[!--titleurl--]";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com[!--titleurl--]">   

 

添加完上面代碼后,帝國cms的電腦網站的每個頁面都可以跳轉到手機靜態網站了。

但手機靜態站是有缺點的,每一次我們在電腦端更新了文章,需要到手機端后臺再生成一次html,比較麻煩,所以我們可以把手機站設置成動態訪問,下面就說一下帝國cms電腦網站跳轉到手機動態站的方法。

 

方法二:帝國cms電腦網站跳轉到手機動態站的方法

1、首先在電腦端的多訪問端設置,把手機端設置成強制動態頁面模式。這樣手機站就是動態了,不用每次都去生成html 。

2、接下來就是給電腦端模板的首頁、列表頁、內容頁添加相依跳轉代碼,和方法一類似。

js是瀏覽器跳轉,meta是告訴搜索引擎移動頁面的地址。

(1)首頁模板需添加下面代碼
<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com/";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com/">   

 

(2)封面頁和列表頁添加下面代碼

<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com/e/action/ListInfo/?classid=[!--self.classid--]";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com/e/action/ListInfo/?classid=[!--self.classid--]">   


(3)內容頁添加下面代碼

<script type="text/javascript">
try {var urlhash = window.location.hash;if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://m.lazybirdfly.com/e/action/ShowInfo.php?classid=[!--classid--]&id=[!--id--]";}}}
catch(err)
{
}</script>
<meta name="mobile-agent" content="format=xhtml;url=http://m.lazybirdfly.com/e/action/ShowInfo.php?classid=[!--classid--]&id=[!--id--]">   

 

添加上面代碼后,pc網站就可以跳轉到手機端的對應網頁了。

注意:使用上面代碼時,把代碼中的域名改成你自己的域名就可以了。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 哈密市| 昌吉市| 怀仁县| 六安市| 达日县| 海南省| 黎川县| 遵义县| 平江县| 上犹县| 沙雅县| 麻江县| 萨迦县| 博罗县| 湘潭县| 许昌市| 高密市| 锡林浩特市| 广元市| 鄂州市| 张掖市| 咸丰县| 法库县| 澄城县| 孟州市| 双柏县| 义乌市| 内黄县| 仙居县| 若尔盖县| 广灵县| 漯河市| 溧阳市| 杨浦区| 绥棱县| 杂多县| 资源县| 栖霞市| 眉山市| 百色市| 麻江县|