Home Backend Development PHP Tutorial Introduction to the use and production methods of dedecms dreamweaver mobile phone template

Introduction to the use and production methods of dedecms dreamweaver mobile phone template

Mar 31, 2017 am 09:55 AM

The latest version of the dedecms system has added a lot of designs for mobile phones, DreamweaverAfter updating , the default default template includes the mobile phone template, so we can design dual templates for the Dreamweaver website, the computer website pc template and the mobile wap template. The following will introduce the use and production of the dedecms Dreamweaver mobile template. Method, you can refer to it if necessary

When making templates, we usually refer to the tag usage in the default template of Dreamweaver, so next we will analyze the use of mobile phones in the default template of Dreamweaver. Template making method

Note: This tutorial is suitable for webmasters who have experience in Dreamweaver template development. If you are a novice, it is recommended to familiarize yourself with Dreamweaver pc template development first.

1. Naming rules for mobile phone templates

In the default template of New Dreamweaver, in addition to the original templates, there are some more mobile phone templates. The main mobile phone templates are as follows:

index_m.htm Home Page Template

Index_default_m.htm Channel Page Template

list_default_m.htm List Page Template

list_default_sg_m.htm List Page Template

article_article_m .htm content page template

article_default_m.htm content page default template

search_m.htm search page template

head_m.htm top template

footer_m.htm Bottom template

dedecms template download address: www.php.cn/xiazai/code/dedecms

Webmasters who are familiar with the production of Dreamweaver computer website templates can roughly understand the correspondence of these mobile templates at a glance There are some differences in the usage and production of these mobile phone templates and PC templates. Let’s talk about the specific differences between mobile phone templates and PC templates#.

## (1) The naming of mobile phone templates is different

As can be seen from the naming of mobile phone templates above, the naming difference between mobile phone templates and pc templates Just add "_m" after the pc template. For example, the pc home page template is index.htm, and the corresponding mobile phone template is index_m.htm; the pc list page template is list_article.htm, and the corresponding mobile phone list page template is list_article_m.htm.

And when making a pc template, there should be a pc template. Just make a corresponding mobile phone template and name it as above, so that the corresponding page can be displayed normally when accessed by computers and mobile phones.

(2) The resource locations called by mobile phone templates are different.

When making PC templates, the css,

js, and images called are all in the template file. folder, for example, the css, js, and images in the default template are all in it. The css, js, images and other resources called by the mobile template are all in the /m/asset

s folder in the root directory of the website.

Of course we can set the location of the resource call in the mobile template to the template folder. But I analyzed it and found that it is beneficial to call the default mobile phone template resources in this way. Separate the mobile phone template resources and pc template resources, so that when we make another pc template and want to add the existing mobile phone template to this When it is in a new PC template, you only need to copy the mobile phone template file to the new PC template. The css, js and other resources of the mobile phone do not need to be touched. Simply put, it is convenient for mobile phone resource management. Therefore, it is recommended that the mobile phone template resources be placed in the corresponding folder of the root directory as the default template.

(3) m folder in the root directory of the website

There is an m folder in the root directory of New Dreamweaver. This is the folder accessed by the mobile phone. Just now I said that the mobile phone template resources are in the m folder. In addition, there are index.php, list.php, and view.php under the m folder. When we access the mobile site, we actually access these three files and dynamically access the mobile site.

So if you want to use a computer to check your mobile website, the method is to visit: http://your domain name/m, and you can check the mobile website.

(4) Settings in the pc template

When we access the website with a mobile phone, it will automatically jump to the mobile phone template. This requires adding a jump to the pc template. Converted js code. Add code in .

* Add the following code to the homepage template:

The code is as follows:

<meta http-equiv="mobile-agent" content="
for
mat=xhtml;url={dede:global.cfg_mobileurl/}/index.php"></p>
<p><script type="text/
javascript
">
if
(window.location.to
String
().indexOf(&#39;pref=padindex&#39;) != -1){}
else
</p>
<p>{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||</p>
<p>(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-</p>
<p>|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?</p>
<p>mobile")<0){try{if(/
Android
|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test</p>
<p>(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/index.php";}else if</p>
<p>(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
Copy after login
* Add the following code to the list page template:

The code is as follows:

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}"></p>
<p><script type="text/javascript">if(window.location.toString().indexOf(&#39;pref=padindex&#39;) != -1){}else</p>
<p>{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||</p>
<p>(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-</p>
<p>|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?</p>
<p>mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test</p>
<p>(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/list.php?tid=</p>
<p>{dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
Copy after login
*Add the following code to the content page template

The code is as follows:

<meta http-equiv="mobile-agent" content="format=xhtml;
url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}">
</p>
<p><script type="text/javascript">if(window.location.toString().indexOf(&#39;pref=padindex&#39;) != -1){}else</p>
<p>{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||</p>
<p>(/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("?</p>
<p>mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test</p>
<p>(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/view.php?aid=</p>
<p>{dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
Copy after login
The above js is The computer website jumps to the code of the mobile website, and is used to tell Baidu the address of the mobile website, mainly used for SEO.

After adding the above code to the pc template, when the mobile phone accesses the website, it will automatically jump to the mobile website template.

(5) Mobile phone template settings

刚才说过了手机网站访问的是网站根目录的m文件夹下的index.php,list.php,view.php ,手机网站是访问动态页面,而不像pc站中的静态页面。

手机模板制作时,有两个地方和pc模板不同。

一、栏目超链接不同

在pc模板中,如导航栏,栏目超链接调用如下:

代码如下:

{dede:channel type=&#39;
top
&#39; row=&#39;10&#39; }</p>
<p><a href=&#39;[field:typeurl/]&#39; >这是栏目内容</a></p>
<p>{/dede:channel}
Copy after login

手机模板调用栏目超链接代码如下:

代码如下:

{dede:channel type=&#39;top&#39; row=&#39;10&#39; }</p>
<p><a href=&#39;list.php?tid=[field:id/]&#39; >这是栏目内容</a></p>
<p>{/dede:channel}
Copy after login

二、文章列表超链接不同

pc模板中文章列表超链接调用代码如下:

代码如下:

{dede:arclist row=&#39;10&#39; }</p>
<p><a href=&#39;[field:arcurl/]&#39; >这是文章标题</a></p>
<p>{/dede:arclist}
Copy after login

手机模板调用文章列表超链接代码如下:

代码如下:

{dede:arclist row=&#39;10&#39; }</p>
<p><a href=&#39;view.php?aid=[field:id/]&#39; >这是文章标题</a></p>
<p>{/dede:arclist}
Copy after login

除了这两个超链接不一样,其他的织梦标签通用。

(6)默认的手机搜索页模板search_m.htm不能用

经测试发现,默认的手机搜索模板search_m.htm不能用,但用手机搜索时,搜索结果用的是pc搜索模板search.htm 。

这是因为手机模板中搜索也是调用的pc站的搜索功能。如果需要让手机网站可以调用search_m.htm ,就需要单独设置搜索功能页面。

总结

好了,按照以上的步骤完成pc站的跳转,和手机站链接的注意事项,你就可以开始做自己的织梦手机模板了,方法和pc站模板开发类似。开发时,可以多参考默认default的手机模板。感兴趣的朋友们快去动手试试吧,如果有疑问可以留言交流,小编会尽快给大家回复的。

The above is the detailed content of Introduction to the use and production methods of dedecms dreamweaver mobile phone template. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Where is the imperial cms resource network template? Where is the imperial cms resource network template? Apr 17, 2024 am 10:00 AM

Empire CMS template download location: Official template download: https://www.phome.net/template/ Third-party template website: https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/Installation method: Download template Unzip template Upload template Select template

How dedecms implements template replacement How dedecms implements template replacement Apr 16, 2024 pm 12:12 PM

Template replacement can be implemented in Dedecms through the following steps: modify the global.cfg file and set the required language pack. Modify the taglib.inc.php hook file and add support for language suffix template files. Create a new template file with a language suffix and modify the required content. Clear Dedecms cache.

How to upload local videos to dedecms How to upload local videos to dedecms Apr 16, 2024 pm 12:39 PM

How to upload local videos using Dedecms? Prepare the video file in a format that is supported by Dedecms. Log in to the Dedecms management backend and create a new video category. Upload video files on the video management page, fill in the relevant information and select the video category. To embed a video while editing an article, enter the file name of the uploaded video and adjust its dimensions.

What website can dedecms do? What website can dedecms do? Apr 16, 2024 pm 12:24 PM

Dedecms is an open source CMS that can be used to create various types of websites, including: news websites, blogs, e-commerce websites, forums and community websites, educational websites, portals, other types of websites (such as corporate websites, personal websites, photo album websites, video sharing website)

How to use dedecms How to use dedecms Apr 16, 2024 pm 12:15 PM

Dedecms is an open source Chinese CMS system that provides content management, template system and security protection. The specific usage includes the following steps: 1. Install Dedecms. 2. Configure the database. 3. Log in to the management interface. 4. Create content. 5. Set up the template. 6. Manage users. 7. Maintain the system.

What loopholes does dedecms have? What loopholes does dedecms have? Aug 03, 2023 pm 03:56 PM

DedeCMS is an open source content management system that has some potential vulnerabilities and security risks: 1. SQL injection vulnerability. Attackers can perform unauthorized operations or obtain sensitive data by constructing malicious SQL query statements; 2. File Upload vulnerability, attackers can upload files containing malicious code to the server to execute arbitrary code or obtain server permissions; 3. Sensitive information leakage; 4. Unauthenticated vulnerability exploitation.

Accurate and reliable dedecms conversion tool evaluation report Accurate and reliable dedecms conversion tool evaluation report Mar 12, 2024 pm 07:03 PM

Accurate and reliable dedecms conversion tool evaluation report With the rapid development of the Internet era, website construction has become one of the necessary tools for many companies and individuals. In website construction, using a content management system (CMS) can manage website content and functions more conveniently and efficiently. Among them, dedecms, as a well-known CMS system, is widely used in various website construction projects. However, sometimes we are faced with the need to convert the dedecms website to other formats, in which case we need to use a conversion tool

A simple way to learn dedecms encoding conversion function A simple way to learn dedecms encoding conversion function Mar 14, 2024 pm 02:09 PM

Learning dedecms encoding conversion function is not complicated. Simple code examples can help you quickly master this skill. In dedecms, the encoding conversion function is usually used to deal with problems such as Chinese garbled characters and special characters to ensure the normal operation of the system and the accuracy of data. The following will introduce in detail how to use the encoding conversion function of dedecms, allowing you to easily cope with various encoding-related needs. 1.UTF-8 to GBK In dedecms, if you need to convert UTF-8 encoded string to G

See all articles