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:
- 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 independent
mobileDirectory. - 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. - 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 end
www.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)
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.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.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.