PHPCMS Build WAP Mobile website, phpcms build WAP
Phpcms Build PC-side web site is more convenient, but in the WAP mobile phone side is not practical, and the mobile phone built station feel is not very good, and the template is not good control, and now modify it, mobile phone station personal feeling more convenient
First, write a custom function in phpcms/libs/functions/extention.func.php that determines the phone's access.
Php/** * extention.func.php user-defined function library * * @copyright (C) 2005-2010 phpcms * @license * @lastmodi FY 2010-10-27*///determine if mobile AccessfunctionCheck_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 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))return true; $clientkeywords=Array( ' Nokia ', ' Sony ', ' Ericsson ', ' mot ', ' Samsung ', ' HTC ', ' SGH ', ' lg ', ' sharp ', ' sie-', ' Philips ', ' Panasonic ', ' Alcat El ', ' Lenovo ', ' iphone ', ' ipod ', ' blackberry ', ' Meizu ', ' Android ', ' NetFront ', ' Symbian ', ' UCWeb ', ' WindowsCE ', ' Palm ', ' operamini ', ' Operamobi ', ' opera mobi ', ' Openwave ', ' nexusone ', ' cldc ', ' 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; }}?>
Then create a folder in the Phpcms/templates/default template folder to store the template of the mobile station
I set up a folder called Mobile.
And then Modify
phpcms/templates/modules/content/index.php file
Trouble points, respectively, in the Channel page, list page, content page load template to judge
Like what:
if (Check_wap ()) { include$template); Else { include$template); }
This will load the template in the Mobile folder when accessed by mobile phone, the template name in the Mobile folder should be the same as the PC side.
Of course, there will be problems when generating static pages, the current solution is to use mobile phone-side dynamic,
You can do this when you call data
After all, the cell phone side of the column is not many
http://www.bkjia.com/PHPjc/1056404.html www.bkjia.com true http://www.bkjia.com/PHPjc/1056404.html techarticle Phpcms Build WAP Mobile website, phpcms build WAP Phpcms build PC-side website is more convenient, but in the WAP mobile phone side is not practical, and the mobile phone built station feel is not very good, and ...