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

首頁 > CMS > 帝國(guó)Empire > 正文

帝國(guó)cms電腦pc站url跳轉(zhuǎn)到手機(jī)站url的方法使用說明

2024-08-28 12:25:39
字體:
供稿:網(wǎng)友

帝國(guó)cms電腦pc站url跳轉(zhuǎn)到手機(jī)站url的方法 

本文講解一下帝國(guó)cms電腦網(wǎng)站跳轉(zhuǎn)到手機(jī)動(dòng)態(tài)網(wǎng)站和手機(jī)靜態(tài)網(wǎng)站的方法。

方法一:帝國(guó)pc站跳轉(zhuǎn)到手機(jī)靜態(tài)站

1、假設(shè)我們有帝國(guó)cms 電腦網(wǎng)站www.XXX.com,手機(jī)網(wǎng)站m.XXX.com ,手機(jī)網(wǎng)站使用帝國(guó)cms的多訪問端功能制作,如果不了解帝國(guó)cms多訪問端制作手機(jī)網(wǎng)站的方法

現(xiàn)在電腦端和手機(jī)端都是生成靜態(tài)網(wǎng)站,除了域名不同,靜態(tài)連接地址都是相同的,例如:

www.XXX.com/china/1.html對(duì)應(yīng) m.XXX.com/china/1.html

 

2、接下來要給電腦網(wǎng)站的首頁、列表頁、內(nèi)容頁的模板添加跳轉(zhuǎn)代碼,方法如下:

js是瀏覽器跳轉(zhuǎn),meta是告訴搜索引擎移動(dòng)頁面的地址。

 

(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.XXX.com/";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.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.XXX.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.com<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>">

 

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

<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.XXX.com[!--titleurl--]";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.com[!--titleurl--]">

 

添加完上面代碼后,帝國(guó)cms的電腦網(wǎng)站的每個(gè)頁面都可以跳轉(zhuǎn)到手機(jī)靜態(tài)網(wǎng)站了。

 

但手機(jī)靜態(tài)站是有缺點(diǎn)的,每次我們更新電腦端文章,都要去手機(jī)端后臺(tái)重新生成一下html,比較麻煩,所以我們可以把手機(jī)站設(shè)置成動(dòng)態(tài)訪問,接下來就講解一下電腦端跳轉(zhuǎn)手機(jī)動(dòng)態(tài)站的方法。

 

方法二:帝國(guó)cms電腦網(wǎng)站跳轉(zhuǎn)到手機(jī)動(dòng)態(tài)站的方法

1、首先在電腦端的多訪問端設(shè)置,把手機(jī)端設(shè)置成強(qiáng)制動(dòng)態(tài)頁面模式。這樣手機(jī)站就是動(dòng)態(tài)了,不用每次都去生成html 。

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

js是瀏覽器跳轉(zhuǎn),meta是告訴搜索引擎移動(dòng)頁面的地址。

(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.XXX.com/";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.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.XXX.com/e/action/ListInfo/?classid=[!--self.classid--]";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.com/e/action/ListInfo/?classid=[!--self.classid--]">

 

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

<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.XXX.com/e/action/ShowInfo.php?classid=[!--classid--]&id=[!--id--]";}}}

catch(err)

{

}</script>

<meta name="mobile-agent" content="format=xhtml;url=http://m.XXX.com/e/action/ShowInfo.php?classid=[!--classid--]&id=[!--id--]">

添加上面代碼后,pc網(wǎng)站就可以跳轉(zhuǎn)到手機(jī)端的對(duì)應(yīng)網(wǎng)頁了。

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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 奈曼旗| 南部县| 清新县| 武鸣县| 双鸭山市| 万安县| 岳池县| 平顶山市| 平顺县| 兰西县| 太保市| 清水河县| 和林格尔县| 玉屏| 崇仁县| 海阳市| 金阳县| 长岭县| 襄垣县| 阳新县| 卢湾区| 玛曲县| 个旧市| 黄平县| 西乌珠穆沁旗| 嘉义县| 陇西县| 获嘉县| 东港市| 东辽县| 五家渠市| 兴海县| 泾源县| 建昌县| 同仁县| 金溪县| 尼木县| 海林市| 鹤峰县| 通州区| 鞍山市|