PHPCMS builds a wap mobile website and phpcms builds a wap
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.
<? Php/*** extention. func. php user-defined function library ** @ copyright (C) 2005-2010 PHPCMS * @ license * @ lastmodify 2010-10-27 * // determines whether the mobile phone accesses function check_wap () {if (isset ($ _ SERVER ['HTTP _ VIA ']) return true; if (isset ($ _ SERVER ['HTTP _ X_NOKIA_CONNECTION_MODE']) return true; if (isset ($ _ SERVER ['HTTP _ X_UP_CALLING_LINE_ID ']) return true; if (strpos (strtoupper ($ _ SERVER ['HTTP _ ACCEPT']), "VND. WAP. WML ")> 0) {// Check whet Her the browser/gateway says it accepts WML. $ br = "WML";} else {$ browser = isset ($ _ SERVER ['HTTP _ USER_AGENT '])? Trim ($ _ SERVER ['HTTP _ USER_AGENT ']): ''; if (empty ($ browser) return true; $ 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', 'c Ldc ', 'midp', 'wap ', 'mobile'); if (preg_match ("/(". implode ('|', $ clientkeywords ). ")/I", $ browser) & strpos ($ browser, 'ipad ') ===false) {$ br = "WML ";} else {$ br = "HTML" ;}} if ($ br = "WML") {return TRUE ;}else {return FALSE ;}?>
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 () {include template ('mobile', $ template);} else {include template ('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.
<a href="index.php?m=content&c=index&a=show&catid=25&id={$r['id']}">
After all, there are not many mobile phone topics