Dedecms Weaving Dream Mobile pseudo-static-implementation of static address URL with PC version of the same tutorial + pseudo-static rules

Source: Internet
Author: User
<span id="Label3"></p>PC version Static effect<p><p></p></p><p><p><br></p></p>Mobile pseudo-static Effects<p><p><br></p></p><p><p><br></p></p><span style="color: #e53333">the <span style="color: #e53333"><strong>following tutorial changes the file (utf8/gbk) package download:</strong></span></span><p><p><span style="color: #e53333">Back up the following 4 files before modifying or overwriting a file<br>\m\index.php<br>\m\list.php<br>\m\view.php<br>\include\arc.listview.class.php</span></p></p><p><p>Link: https://pan.baidu.com/s/1i49ABe1 password: 2wid<br></p></p><p><p></p></p><p><p><strong><span style="color: #e53333; font-size: 18px">static generation of the computer version here is not much to say, the mobile version of the pseudo-static operation Tutorial is as Follows:</span></strong></p></p><p><p><strong>1. The mobile domain name m.123.com resolves and points to the M folder of the bound directory to the site directory</strong></p></p><p><p><br></p></p><p><p><strong>2. Background-system configuration Add Variables <strong>(in order to use the absolute path, using the computer version of the article image, in order to move the template css, js, images use absolute Path)</strong></strong><br>Variable name: cfg_mobile<br>Variable type: text<br>Parameter description: Mobile Version URL<br>Variable value: http://m.123.com<br>Owning Group: Site Settings<br><br>Variable name: cfg_rewritem<br>Variable Type: boolean (y/n)<br>Parameter Description: Mobile Version pseudo-static<br>Variable value: Y<br>Owning Group: Site Settings</p></p><p><p><br></p></p><p><p><br></p></p><p><p>Column list "file save directory" can be the following form</p></p><p><p><br></p></p><p><p><br></p></p><p><br><strong><strong>3.\m\index.php modified to always be dynamic, does not generate index.html</strong></strong><br>Put the inside<br>$row [' showmod '] = isset ($row [' showmod '])? $row [' showmod ']: 0;<br>If ($row [' showmod '] = = 1)<br>{<br>$pv->savetohtml (dirname (__file__). ' /index.html ');<br>Include (dirname (__file__). ' /index.html ');<br>Exit ();<br>} else {<br>$pv->display ();<br>Exit ();<br>}<br>Change into<br>$pv->settemplet ($cfg _basedir. $cfg _templets_dir. "/" . $row [' Templet ']);<br>$pv->display ();<br>Exit ();<br><br><strong><strong>4.\m\list.php adding pseudo-static judgment</strong></strong><br>Put the inside<br>$tid = (isset ($tid) && is_numeric ($tid)? $tid: 0);<br>Change into<br>If ($cfg _rewritem = = ' Y ')<br>{<br>$typedir = Parse_url ($tid, php_url_path);<br>$PageNo = Stripos (getcururl (), '. HTML ')? Intval (str_replace ('. HTML ', ', end (explode ("_", getcururl ()))): 1;<br>$tinfos = $dsql->getone ("select * from ' #@__arctype ' WHERE typedir= '/$typedir ' or typedir= ' {cmspath}/$typedir '");<br><br>If (is_array ($TINFOS))<br>{<br>$tid = $tinfos [' ID '];<br>$typeid = Getsonids ($tid);<br>$row = $dsql->getone ("select count (id) as total from ' #@__archives ' where typeid in ({$typeid})");<br>$TotalResult = Is_array ($row)? $row [' Total ']: 0;<br>}<br>Else<br>{<br>$tid = 0;<br>}<br>}<br>Else<br>{<br>$tid = (isset ($tid) && is_numeric ($tid)? $tid: 0);<br>}<br><br><strong><strong>5.\m\view.php adding pseudo-static judgment</strong></strong><br>In<br>$t 1 = exectime ();<br>Add below<br>If ($cfg _rewritem = = ' Y ')<br>{<br>$aid = Stripos (getcururl (), '. HTML ')? Intval (str_replace ('. HTML ', ', end (explode ("/", getcururl ()))): 0;<br>}<br><br><strong><strong>6.\include\arc.listview.class.php Add the mobile version of pseudo-static paging function, find</strong></strong><br>Global $cfg _rewrite;<br>Change into<br>Global $cfg _rewrite, $cfg _rewritem;<br>Continue to find<br>$geturl = "tid=". $this->typeid. " &totalresult= ". $this->totalresult." & ";<br>$purl. = '? '. $geturl;<br>Change into<br>If ($cfg _rewritem = = ' Y ')<br>{<br>$purl = "";<br>}<br>Else<br>{<br>$geturl = "tid=". $this->typeid. " &totalresult= ". $this->totalresult." & ";<br>$purl. = '? '. $geturl;<br>}<br>Continue to find the following<br>Return $plist;<br>Add it on top of it<br>If ($cfg _rewritem = = ' Y ')<br>{<br>$plist = preg_replace ("/pageno= (\d+)/i", '<span style="color: #e53333">List_ '. $this->typeid. ' _\\1<span style="color: #000000"><span style="color: #000000">. html ', $plist);</span></span><br><span style="color: #000000"><span style="color: #000000">}</span></span><br><br><span style="color: #000000"><span style="color: #000000"><strong>7. Tags are used in mobile templates</strong></span></span><br><span style="color: #000000"><span style="color: #000000">{dede:global.cfg_mobile/} http://m.123.com</span></span><br><span style="color: #000000"><span style="color: #000000">[field:global.cfg_basehost/][field:litpic/] pictures with the main station, such as: http://www.123.com/uploads/allimg/170513/20493W4S-0.jpg</span></span><br><span style="color: #000000"><span style="color: #000000">{dede:field.body/}</span></span><br><span style="color: #000000"><span style="color: #000000">Change into</span></span><br><span style="color: #000000"><span style="color: #000000">{dede:field.body runphp=yes}</span></span><br><span style="color: #000000"><span style="color: #000000">Global $cfg _basehost;</span></span><br><span style="color: #000000"><span style="color: #000000">$str = @me;</span></span><br><span style="color: #000000"><span style="color: #000000">$search = '/(]+>)/is ';//filter the width in img</span></span><br><span style="color: #000000"><span style="color: #000000">$search 1 = '/(]+>)/is ';//filter the height in img</span></span><br><span style="color: #000000"><span style="color: #000000">$search 2 = ' # () #i ';//filter The width of the style in IMG</span></span><br><span style="color: #000000"><span style="color: #000000">$search 3 = ' # () #i ';//filter The height of the style in IMG</span></span><br><span style="color: #000000"><span style="color: #000000">$content = preg_replace ($search, ' $1$3 ', $str);</span></span><br><span style="color: #000000"><span style="color: #000000">$content = preg_replace ($search 1, ' $1$3 ', $content);</span></span><br><span style="color: #000000"><span style="color: #000000">$content = preg_replace ($search 2, ' $1$2 ', $content);</span></span><br><span style="color: #000000"><span style="color: #000000">$content = preg_replace ($search 3, ' $1$2 ', $content);</span></span><br><span style="color: #000000"><span style="color: #000000">@me = $content;</span></span><br><span style="color: #000000"><span style="color: #000000">@me = str_replace ('/uploads/allimg/', $cfg _basehost. ' /uploads/allimg/', $content);//mobile Image use absolute path</span></span><br><span style="color: #000000"><span style="color: #000000">{/dede:field.body}</span></span><br><span style="color: #000000"><span style="color: #000000">Other labels are the same as the computer version</span></span></span></p><p><p><br></p></p><p><p><strong>8. Mobile Pseudo-static Rules</strong> <strong>Apache</strong></p></p><p><p><span style="color: #e53333">. htaccess put it under the M folder</span></p></p><p><p><br></p></p><p><p>Note that the column "list naming rules" to correspond to pseudo-static column paging rules and \include\arc.listview.class.php inside the page rules.</p></p><p><p><br></p></p><p><p>#dedecms移动版伪静态<br>Rewriteengine on<br>rewritebase/<br><br>#移动版列表栏目<br>Rewriterule ^ (. *)/$/list.php?tid=$1<br>#移动版列表栏目分页<br>Rewriterule ^ (. *)/<span style="color: #e53333">list_ ([0-9]+) _ ([0-9]+) \<span style="color: #000000">. html$/list.php?tid=$1&pageno=$2</span><br><span style="color: #000000">#移动版文章页伪静态规则</span><br><span style="color: #000000">Rewriterule ^ (. *)/([0-9]+) \.html$/view.php?aid=$1</span></span></p></p><p><p><br></p></p><p><p><br></p></p><p><p><strong>9. Jump to the mobile version of the computer version of the code</strong></p></p><p><p> <br> <span style="color: #009900">1) home <br> <meta http-equiv= "mobile-agent" content= "format=xhtml;url={dede: global.cfg_mobile/} ", <br> <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| mot-| nokia| sonyericsson| sie-| 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_mobile/}";} else if (/ipad/i.test (navigator.useragent)) {}else{}}catch (e) {}}}}</script> </span> </p></p><p><p><span style="color: #009900"><br><span style="color: #e56600">2) List<br><meta http-equiv= "mobile-agent" content= "format=xhtml;url={dede:global.cfg_mobileurl/}{dede:type}[field: typeurl/]{/dede:type} "><br><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| mot-| nokia| sonyericsson| sie-| 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/}{dede:type}[field: typeurl/]{/dede:type} ";} else if (/ipad/i.test (navigator.useragent)) {}else{}}catch (e) {}}}}</script></span></span></p></p><p><span style="color: #009900"><span style="color: #e56600"><br><span style="color: #e53333"><span style="color: #e53333">3) Content<br><meta http-equiv= "mobile-agent" content= "format=xhtml;url={dede:global.cfg_mobile/}{dede:field.id runphp=yes}$ result=getonearchive (@me); @me = $result [' arcurl ']; {/dede:field.id} "><br><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| mot-| nokia| sonyericsson| sie-| 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_mobile/}{dede:field.id runphp= yes} $result =getonearchive (@me) @me = $result [' arcurl ']; {/dede:field.id} ";} else if (/ipad/i.test (navigator.useragent)) {}else{}}catch (e) {}}}}</script><br><br><br><strong><span style="color: #e53333">Completed. </span></strong> </span></span></span></span></p><p><p></p></p><p><p> Dedecms Dream Mobile pseudo-static-implementation of static address URL with PC version of the same tutorial + pseudo-static rules </p> </p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.