Use PHPCMS to build WAP mobile website, phpcms build WAP mobile phone _php tutorial

Source: Internet
Author: User

Use PHPCMS to build WAP mobile website, phpcms build WAP mobile phone


The following is to tell you how to use Phpcms to build WAP mobile website, the specific content please see below.

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 * @lastmodify 2010-10-27 *///determines if the phone accesses function Check_wap () {if (Isset ($_server[' Http_via '))) return true; if (Isset ' $_server[ 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 ', ' Alcatel ', ' 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 (' Mobile ', $template);   } else {    include template (' content ', $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.

About the use of Phpcms to build WAP mobile website All the content of the introduction, need to know about phpcms knowledge, please continue to pay attention to this site, and welcome all of you friends

http://www.bkjia.com/PHPjc/1057478.html www.bkjia.com true http://www.bkjia.com/PHPjc/1057478.html techarticle use PHPCMS to build WAP mobile website, phpcms build WAP mobile phone below to everyone talk about using PHPCMS to build WAP Mobile site method, the specific content please see below. 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.