: This article describes how to set up a wap mobile website using PHPCMS. For more information about PHP tutorials, see. PHPCMS is easy to build a PC-side website, but it is not very practical in terms of wap mobile phone, and the built-in mobile phone website creation is not very good, and the template is not easy to control, and now it is modified, mobile phone website creation is more convenient
First, write a UDF in phpcms/libs/functions/extention. func. php to determine mobile access.
0) {// Check whether the browser/gateway says it accepts WML. $ br = "WML";} else {$ browser = isset ($ _ SERVER ['http _ USER_AGENT '])? Trim ($ _ SERVER ['http _ USER_AGENT ']): ''; if (empty ($ browser) returntrue; $ clientkeywords = array ('Nokia', 'Sony ', 'ericsson ', 'MOT', 'Samsung', 'HTC ', 'sgh', 'LG', 'sharp ', 'sie-', 'Philips ', 'panasonic ', 'alcatel', 'Lenovo', 'iPhone ', 'iPod', 'BlackBerry ', 'meizu', 'Android', 'netfront', 'symbian ', 'ucweb', 'windowsce ', 'Palm', 'operamini ', 'operamobi', 'Opera mobi', 'openwave ', 'nexusone', 'cl Dc ', 'midp', 'wap ', 'mobile'); if (preg_match ("/(". implode ('|', $ clientkeywords ). ")/I", $ browser) & strpos ($ browser, 'iPad ') ===false) {$ br = "WML ";} else {$ br = "HTML" ;}} if ($ br = "WML") {returnTRUE ;} else {returnFALSE ;}}?>
Create a folder in the phpcms/templates/default template folder to store the template of the mobile phone site.
Create a folder named mobile
Then modify
Phpcms/templates/modules/content/index. php file
Trouble: determine when loading templates on the channel page, list page, and content page.
For example:
If (check_wap ()){IncludeTemplate ('mobile', $ template);} else {IncludeTemplate ('content', $ template );}
In this way, the template in the mobile folder will be loaded when accessed by a mobile phone. the template name in the mobile folder should be the same as that in the PC.
Of course, there will be problems when generating static pages. The current solution is to use dynamic on the mobile phone end,
This is the case when calling data.
After all, there are not many mobile phone topics
The above describes how to set up a wap mobile website in PHPCMS, including some content, and hope to help those who are interested in PHP tutorials.