Where should the mobile-specific template file be stored to be recognized by AnQiCMS?

Calendar 👁️ 67

Provide special optimization for the mobile experience of the website in AnQiCMS (AnQiCMS), which is a very practical requirement.Benefiting from the flexible template mechanism of AnQiCMS, we can easily achieve this goal.When it is necessary to provide a set of independent template files for mobile devices, the storage location and configuration method of these templates are crucial.

In simple terms, if you want AnQiCMS to recognize and apply templates specifically designed for mobile devices, you need to place these template files in the currently usedUnder the template theme directorymobileIn the subdirectory.

AnQiCMS provides three main modes in template design to meet different website needs:

  1. Adaptive Mode (Responsive): In this mode, the PC and mobile ends use the same template files.By using CSS media queries and other technologies, websites can automatically adjust layouts and styles based on the screen size of the user's device to provide an** enhanced browsing experience.In this mode, it is usually not necessary to have an independentmobileDirectory.
  2. Code Adaptation mode (Code Adaptation)In this mode, the system will detect the user's device type through backend code and load different templates according to the detection results.If you choose this mode, the PC template and mobile template will be two independent files.The mobile template must be stored in the main template directory.mobileIn the subdirectory.
  3. PC+Mobile Independent Sites Mode (PC+Mobile Independent Sites)This mode is more thorough, the PC and mobile ends not only use independent templates, but can also bind independent domains. For example, access on the PC endwww.yourdomain.com, access on the mobile endm.yourdomain.comIn this case, the mobile template also needs to be stored in the main template directory.mobilein the subdirectory.

Whether it is the "code adaptation" or the "PC + mobile independent site" model,mobileThe catalog plays a crucial role. ThismobileThe catalog is not simply an empty folder, the internal directory structure and template file naming conventions should be consistent with your PC template directory. For example, if your PC homepage template isindex.htmlArticle detail page template isarchive/detail.html, you can bemobileUnder the directory, you should also haveindex.htmlandarchive/detail.html(Or other naming conventions for mobile-specific templates, such asarchive/detail-mobile.html),They will respectively bear the design of the mobile home page and article detail page. In this way, when the system detects mobile device access, it will automatically frommobileSearch for and load the corresponding template file in the directory.

To enable this independent mobile template mode on the AnQiCMS backend, you need to select the corresponding template type (such as 'code adaptation' or 'computer + mobile') in 'System Settings' or 'Global Settings'.If you choose the PC + mobile independent site mode, you need to further configure the 'mobile site address', pointing to the domain name of your mobile site.

By this structured management approach, you can ensure that mobile users get a specially optimized browsing experience, as well as efficiently organize and maintain the template files of the website, achieving precise control over different access devices.


Frequently Asked Questions (FAQ)

  1. Do you need to create a directory and place the mobile template in "Adaptive" mode?mobileDo you need to create a directory and place the mobile template in "Adaptive" mode?Generally not required. Adaptive mode is designed to use a single template to fit all devices, and the template itself adjusts the layout through responsive design (such as CSS media queries).Therefore, in this mode, AnQiCMS will not gomobileThe directory searches for template files. Only consider using "code adaptation" or "PC + independent mobile site" mode and creating a template when you truly need to provide a completely independent template for mobile devices that does not depend on responsive design.mobileDirectory.

  2. mobileDoes the naming of template files within the directory need to be consistent with the PC end?Yes, in order for AnQiCMS to correctly match and load the mobile template,mobileThe template file naming within the directory should be consistent with the corresponding file on the PC template. For example, if the PC template for the article list page isarchive/list.htmlThen the mobile article list page template should also be namedmobile/archive/list.htmlThe system will automatically search for the corresponding match file in the directory based on the URL and device typemobilein the directory.

  3. How to ensure that AnQiCMS correctly associates PC and mobile templates?This is mainly achieved through two aspects: first, in the background "Global Settings", you need to set the "Template Type" to "Code Adaptation" or "Computer + Phone" mode; second, make sure that all your mobile template files are correctly placed in the main template directory.mobileIn the subdirectory, and its naming should be consistent with the template file on the PC end. AnQiCMS will determine the device type when receiving an access request based on the User-Agent, and then decide whether to use the root template directory ormobileThe subdirectory loads the corresponding page template.

Related articles

Why is UTF8 encoding crucial for the display of content in AnQiCMS templates?

## Content display no longer troubles: Why is UTF-8 encoding so critical for AnQiCMS templates?In the process of building and operating a website with AnQiCMS, we often strive for the website's efficiency, stability, and diverse display of content.However, there is a seemingly basic but actually crucial link that, if not handled properly, will cause all our efforts to be wasted - that is the character encoding of the template file.Especially for AnQiCMS, UTF-8 encoding is not just a recommendation, it is the core foundation to ensure that website content is displayed correctly and clearly.

2025-11-08

How to use conditional judgment and loop control to dynamically adjust the display of content?

In Anqi CMS, we often encounter scenarios where we need to display different information based on specific conditions or repeat a series of contents.At this time, by flexibly using conditional judgment and loop control, the website content can become more vivid and intelligent.The AnQi CMS template feature provides powerful syntax support similar to the Django template engine, through these tags, we can easily achieve dynamic content adjustment without writing complex background code. ### Conditional judgment: Make the content 'speak to people' Conditional judgment is the basis for dynamic content display.Imagine

2025-11-08

How to display variables in AnQiCMS templates?

In AnQiCMS templates, how to effectively display variable data is a core skill that every website operator and template creator needs to master.AnQiCMS uses a syntax similar to the Django template engine, making data calls and display both intuitive and flexible.This article will delve into various ways to display variables in AnQiCMS templates, helping you accurately present dynamic information such as backend configuration data and article content on the website front-end.

2025-11-08

What file extension should AnQiCMS template files use to ensure correct display?

When using AnQiCMS for website construction and content management, ensuring that the template files are displayed correctly is the foundation for the normal operation of the website.This is where, the naming convention of template files, especially the file extension, plays a crucial role. The template files of Anqi CMS have a clear and unified file extension requirement, which is to use **.html** as the file extension of the template files.These files are usually organized in the `/template` folder under the root directory of the website.Choose `.html`

2025-11-08

How does AnQiCMS automatically apply the default display template for documents or categories through naming conventions?

In website operation, template management is the key to ensuring the professionalism and consistency of content display.For many operators, manually selecting or specifying a template for each new article or category is undoubtedly a repetitive and time-consuming task.AnQi CMS understands this pain point, therefore it introduces a set of intelligent naming conventions, allowing the system to automatically identify and apply default display templates, thereby greatly simplifying our daily operations.The cleverness of this feature lies in AnQiCMS's ability to intelligently associate content with preset design styles according to the specific naming rules of template files

2025-11-08

How does the `template_type` setting in `config.` affect the overall display mode of the website?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides great convenience to our users.During the process of building and operating a website, there is a core configuration file called `config.`, which plays a vital role in each template directory.

2025-11-08

How to reuse header, footer and other common display elements in AnQiCMS templates?

In website operation, efficiency and consistency are the key to success.When you manage a website, you will find that many elements appear repeatedly on different pages, such as headers, footers, navigation bars, sidebars, and so on.If you copy and paste this code manually every time, it is not only inefficient but also prone to errors, not to mention the cumbersome task of adjusting each one individually during subsequent modifications.Fortunately, AnQiCMS's template system is designed to be very flexible, providing powerful mechanisms to help us efficiently reuse these common display elements, ensuring the uniformity of the website style and making maintenance easier.

2025-11-08

How to embed reusable display components such as sidebars or breadcrumbs in a page?

In website operation, building an efficient and easy-to-maintain website is the key to success.AnQiCMS (AnQiCMS) is well aware of this, providing a flexible template mechanism that allows us to easily embed reusable display components on the page, such as sidebars and breadcrumb navigation.This modular method not only improves development efficiency, but also ensures the consistency of the overall style of the website and future maintainability.This article will delve into how to effectively create and embed these important reusable components using the template system in AnQiCMS.##

2025-11-08