Use PHPCMS to build a wap mobile website and phpcms to build a wap mobile phone _ PHP Tutorial

Source: Internet
Author: User
Use PHPCMS to build a wap mobile website and phpcms to build a wap mobile phone. Use PHPCMS to build a wap mobile website. use phpcms to build a wap mobile phone. The following describes how to use PHPCMS to build a wap mobile phone website. For more information, see the following. First, build a wap mobile website using PHPCMS in phpcmslibsfunctions, and build a wap mobile phone in phpcms.

The following describes how to build a wap mobile website using PHPCMS. For more information, see the following.

FirstIn phpcms/libs/functions/extention. func. php, write the user-defined function used to judge mobile phone 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.

 

After all, there are not many mobile phone topics.

All the content for building a wap mobile website using PHPCMS is described. if you need to learn more about phpcms, please stay tuned to this website.

The following describes how to build a wap mobile website using PHPCMS. For more information, see the following. First in phpcms/libs/functions...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.