search
HomeBackend DevelopmentPHP TutorialIntroduction to the use and production methods of dedecms dreamweaver mobile phone template

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>
* 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>
*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>
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}

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

代码如下:

{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}

二、文章列表超链接不同

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

代码如下:

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

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

代码如下:

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

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

(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
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
PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

How does PHP handle object cloning (clone keyword) and the __clone magic method?How does PHP handle object cloning (clone keyword) and the __clone magic method?Apr 17, 2025 am 12:24 AM

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP vs. Python: Use Cases and ApplicationsPHP vs. Python: Use Cases and ApplicationsApr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.