织梦电脑站手机站伪静态和全套伪静态规则(4)

下载地址:

  文件替换  

包括iis6、iis7、8、apache、nginx,下载后选择对应的伪静态规则文件

5.把所有手机版模板文件(_m.htm 结尾的),把模板里面的代码都改成电脑版

还有几个特别的,请认真对比下面

 

css、js、images 改成绝对路径,例如 assets/css/ 改成 /assets/css/

 

index.php 改成 {dede:global.cfg_mobile/}

 

list.php?tid=[field:id/] 改成 [field:typelink/]
 

list.php?tid=~id~ 改成 ~typelink~

 

list.php?tid={dede:field name='id'/} 改成 {dede:field.typeurl/}
 

view.php?aid=[field:id/] 改成 [field:arcurl/]

 

[field:litpic/] 改成 [field:global.cfg_basehost/][field:litpic/]

 

[field:image/] 改成 <img src=https://www.91084.com/"[field:global.cfg_basehost/][field:litpic/]">

 

上下篇记得先修正官方程序的这个BUG,已经修正过的跳过

修复地址:https://www.91084.com/dedecms/wt/98.html

上一篇标签

{dede:prenext get='pre'/}

改成

{dede:prenext get=pre runphp=yes}

$preurl = @me;

preg_match('/aid=(\d*)/',$preurl,$match);

$result = GetOneArchive($match[1]);

@me = !empty($result) ? "上一篇:<a href=\"{$result['arcurl']}\">{$result['title']}</a>" : "上一篇:没有了";

{/dede:prenext}

下一篇标签

{dede:prenext get='next'/}

改成

{dede:prenext get=next runphp=yes}

$preurl = @me;

preg_match('/aid=(\d*)/',$preurl,$match);

$result = GetOneArchive($match[1]);

@me = !empty($result) ? "下一篇:<a href=\"{$result['arcurl']}\">{$result['title']}</a>" : "下一篇:没有了";

{/dede:prenext}

文章内容

{dede:field.body/}

改成

{dede:field.body runphp=yes}

global $cfg_basehost;

$str = @me;

$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';

$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';

$search2 = '#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i';

$search3 = '#(<img.*?style=".*?)height:\d+px;([^"]*?.*?>)#i';

$content = preg_replace($search,'$1$3',$str);

$content = preg_replace($search1,'$1$3',$content);

$content = preg_replace($search2,'$1$2',$content);

$content = preg_replace($search3,'$1$2',$content);

@me = $content;

@me = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);

{/dede:field.body}

栏目内容

{dede:field.content/}

改成

{dede:field.content runphp=yes}

global $cfg_basehost;

$str = @me;

$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';

$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';

$search2 = '#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i';

$search3 = '#(<img.*?style=".*?)height:\d+px;([^"]*?.*?>)#i';

$content = preg_replace($search,'$1$3',$str);

$content = preg_replace($search1,'$1$3',$content);

$content = preg_replace($search2,'$1$2',$content);

$content = preg_replace($search3,'$1$2',$content);

@me = $content;

@me = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);

{/dede:field.content}

搜索框代码改成静态的js提交搜索,参考下面代码

<script type="text/javascript">

function search()

{

    var q = document.getElementById("q").value;

    window.location.href = ""+q+".html";

}

function enterIn(obj,evt)

{

    var evt = evt ? evt : (window.event ? window.event : null);

    if (evt.keyCode == 13)

    {

        var q = obj.value;

        window.location.href = ""+q+".html";

    }

}

</script>

<form action="" method="post" onsubmit="return false">

    <div class="form">

        <h4>搜索</h4>

        <input name="q" id="q" onkeydown="enterIn(this,event);" type="text" />

        <button type="submit" class="search-submit" onclick="search()">搜索</button>

    </div>

</form>

电脑站跳转到手机站代码

1.首页

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}">

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wsfgfw.html