dedecms has a mobile version. The installation method for the mobile version is: 1. Move the DATA to the security settings outside the root directory and modify the "/m/index.php" code; 2. In "Update Homepage HTML" , change "Select Home Page Template" to "default/index_m.htm"; 3. Change the URL of "Graphic and Text Information" on the home page to a mobile link; 4. Set the mobile site to be accessible through the second-level domain name.
The operating environment of this tutorial: Windows 10 system, Dedecms V5.7SP1 version, Dell G3 computer.
Does dedecms have a mobile version?
have.
DedeCMS mobile site installation and usage tutorial
How to use the DedeCMS mobile site:
一, Two ways to install Dedecms mobile site:
(1) Download the new version and install it directly. Dedecms version: V5.7SP1 official version (2015-06-18) This version contains all the features of the old version No mobile site functionality.
(2) Upgrade the old version (only for adding mobile site functions), download the latest version (note that the website encoding must be consistent with the original site), copy the following files in the compressed package to the corresponding directory of the original site:
Note: If the original site has a non-default template, for example, a column template is /templets/defaultst_default_news.htm, you can copy /templets/defaultst_default_m.htm and rename it to list_default_news_m.htm. That is: the PC website template must have a corresponding mobile website template, and the file name of the latter is "_m" after the file name of the former.
The installation or upgrade of dedecms is completed. At this time, you should be able to create a mobile website. However, some problems were found during the use of the mobile site function provided by the dedecms20150618 version, which needs to be modified before it can be used normally, so there are The following steps to modify dedecms are as follows...
2. Modify Dedecms
(1) If the original site has security settings that move DATA outside the root directory, it needs to be modified. /m/index.php code:
if(!file_exists(dirname(__FILE__).'/../data/common.inc.php')) { header('Location:install/index.php'); exit(); }
Change /../data/common.inc.php to /../../data/common.inc.php, or directly change the above 5 Lines of code deleted.
(2) The mobile site homepage will automatically generate a homepage static file when it is accessed for the first time. The premise is that the /m/ directory needs to be set with writable permissions, otherwise it will not be updated normally. Later, to update the static files on the homepage, you need to log in to the background to update manually: in "Update Homepage HTML", change "Select Homepage Template" to "default/index_m.htm" and change "Homepage Location" to "../m/index.html" ”, and then generate the homepage static file.
Note: This version is known as "automatically generate HTML version", but the default mobile site template has a dynamic homepage of Link needs to be replaced with static link form.
※If you find it troublesome to use static pages and want to set the homepage to dynamic browsing, you can modify /m/index.php and replace the code above
$row['showmod']= isset($row['showmod'])? $row['showmod'] : 0; if ($row['showmod'] == 1) { $pv->SaveToHtml(dirname(__FILE__).'/index.html'); include(dirname(__FILE__).'/index.html'); exit(); } else { $pv->Display(); exit(); }
with one line: $pv->Display();
3. The URL in the "Graphic and Text Information" section of the home page is a PC link, and changed to a mobile link:
Search template/templets/default/index_m.htm All in are replaced with
4. The general header contains a search box. The search will jump to the PC search page. It is recommended to delete:
Delete the following code in /templets/default/header_m.htm:
<form class="am-topbar-form am-topbar-leftam-form-inline am-topbar-right"role="search"action="{dede:global.cfg_cmsurl/}/plus/search.php"> <input type="hidden" name="mobile"value="1" /> <input type="hidden" name="kwtype"value="0" /> <div class="am-form-group"> <input name="q" type="text"class="am-form-field am-input-sm" placeholder="输入关键词"> </div> <button type="submit" class="am-btnam-btn-default am-btn-sm">搜索 </button> </form>
5. The mobile site uses the second-level directory by default, and can also use the second-level domain name, so we need to set the mobile site to be accessible through the second-level domain name, resolve the second-level domain name to the server ip where the website is located, and set it on the server/space Bind the second-level domain name to the /m/ directory.
After successfully setting the second-level domain name, you will find that the pictures cannot be displayed when browsing the website through the second-level domain name because the picture path is wrong - the picture path is "/uploads/x/y.jpg" The relative root directory path format is displayed normally on the PC site page because the directory exists under the PC site domain name, and the secondary domain name is bound to the secondary directory, which does not exist, so accessing the image will return a 404 error. There are many solutions to this problem. Here are a few ideas (example PC station: www.dede58.com; mobile station: m.dede58.com):
(1) Set dedecms to use absolute paths
After entering the management background, click "System"->"Basic System Parameters"->"Core Settings", select "(Yes/No) supports multi-site, enable attachments, column connections, arclist content Enable absolute URLs:" (default "No") is set to "Yes".
(2) Modify the template path
Add:
<basehref="http://www.dede58.com" />
to
in all mobile templates and then change in the code“<a href="list.php” 改为完整路径 “<a href="http://m.dede58.com/list.php” “<a href="viewphp” 改为完整路径 “<a href=http://m.dede58.com/view.php
(3)URL 重写
将对http://m.dede58.com/uploads/的访问重写至http://www.dede58.com/uploads/,apache环境下,在/m/目录中的.htaccess(如无则需新建)中增加以下代码即可:
RewriteEngineon RewriteCond %{http_host} ^m.dede58.com [NC] RewriteRule ^uploads/(.*)$ http://www.dede58.com/uploads/$1 [L]
iis环境下类似规则。
另:需将根目录下的/images/defaultpic.gif(缩略图默认图片)复制到/m/目录下,否则列表页中如存在无缩略图的文章,对应缩略图位置会无法正常显示图片。
至此,移动站架设基本成型。
推荐学习:dedecms教程
The above is the detailed content of Does dedecms have a mobile version?. For more information, please follow other related articles on the PHP Chinese website!