In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "jspXCMS PC side and mobile side how to generate static pages at the same time", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn how to generate static pages at the same time in jspXCMS PC side and mobile side "this article.
Static pages are static resources similar to pictures. Accessing static resources will not be processed by the program and will not return different pages according to the browser. To support both PC and mobile browsers, and to generate static pages, it is best to use technologies such as bootstrap to achieve adaptive page design.
If different templates are used on PC and mobile, and static pages need to be generated, two problems need to be solved.
First, the static pages generated by the PC side and the mobile side must be saved in different directories, otherwise the static pages on the PC side will cover the static pages on the mobile side. For example, the home page of both PC and mobile phones is / index.html, which will inevitably save only one file in the end. The home page must be / index.html on the PC side and / m/index.html on the mobile side. Other pages are similar, such as / news/index.html on the PC side and / m/news/index.html on the mobile side.
This requires the creation of another HTML publishing point on the mobile side, with a save path of / m and a display path of / m.
Then set the mobile HTML publishing point in the site management as the previously newly created HTML mobile publishing point.
Second, because the page address on the PC side is different from that on the mobile side, the default is to visit the page on the PC side when users visit it. Because you are accessing a static page, it is impossible to determine what browser access is on the server side without being processed by the server program. At this point, you need to add js code to the page on the PC to determine whether it is accessed by the mobile browser. If so, use js to jump to the static page on the mobile end.
The following code is placed in the home page of the PC template. If the mobile browser visits the home page of the PC, it will automatically jump to the page address of the mobile end.
[# if site.url! = site.urlMobile] / / when generating a static HTML, you need to use js to determine whether it is accessed on the mobile side, and jump to the mobile address var ua = navigator.userAgent Var ipad = ua.match (/ (iPad). * OS\ s ([\ d _] +) /), isIphone =! ipad & & ua.match (/ (iPhone\ sOS)\ s ([\ d _] +) /), isAndroid = ua.match (/ (Android)\ s + ([\ d.] +) /), isMobile = isIphone | | isAndroid;if (isMobile) location.href = "${site.urlMobile}" [/ # if] the above is all the contents of the article "how to generate static pages on PC and mobile in jspXCMS at the same time". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.