Table of Contents
Use PHPCMS to build a wap mobile website and phpcms to build a wap mobile website
Home Backend Development PHP Tutorial Use PHPCMS to build a wap mobile website, phpcms to build a wap mobile phone_PHP tutorial

Use PHPCMS to build a wap mobile website, phpcms to build a wap mobile phone_PHP tutorial

Jul 12, 2016 am 09:08 AM
phpcms wap

Use PHPCMS to build a wap mobile website and phpcms to build a wap mobile website

The following will tell you how to use PHPCMS to build a wap mobile website. Please see below for the specific content.

First, write the custom function to determine mobile phone access in phpcms/libs/functions/extention.func.php

<&#63;php
/**
 * extention.func.php 用户自定义函数库
 *
 * @copyright   (C) 2005-2010 PHPCMS
 * @license    
 * @lastmodify   2010-10-27
 */
//判断是否手机访问
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 whether the browser/gateway says it accepts WML.
  $br = "WML";
 } else {
  $browser = isset($_SERVER['HTTP_USER_AGENT']) &#63; 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;
 }
}
&#63;>
Copy after login

Then create a folder in the phpcms/templates/default template folder to store the templates of the mobile site

I created a folder called mobile

Then modify
phpcms/templates/modules/content/index.php file

Troublesome, make the judgment when loading the template on the channel page, list page, and content page respectively
For example:

     if (check_wap()) {
    include template('mobile', $template);
   } else {
    include template('content', $template);
   }
Copy after login

In this way, when accessed by mobile phone, the template in the mobile folder will be loaded. The name of the template in the mobile folder must be the same as that on the PC.
Of course, there will be problems when generating static pages. The current solution is to use dynamic ones on mobile phones,
You can do this when calling data

<a href="index.php&#63;m=content&c=index&a=show&catid=25&id={$r['id']}">
Copy after login

After all, there are not many columns on the mobile version.

This is all about using PHPCMS to build a wap mobile website. If you need to know more about phpcms, please continue to pay attention to this site, and welcome all friends

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1057478.htmlTechArticleUse PHPCMS to build a wap mobile website, phpcms to build a wap mobile website. Let me tell you how to use PHPCMS to build a wap mobile website. Please see below for details. First in phpcms/libs/functions...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does wap mean? What does wap mean? Mar 09, 2023 pm 05:41 PM

WAP refers to the wireless application communication protocol. It was announced in early 1998 and allows people to use mobile communication terminal devices such as mobile phones to receive various information through the WAP protocol, surf the Internet, browse web pages, send and receive emails, and even conduct online e-commerce. Network Communications Association. WAP consists of a series of protocols. Wireless communication devices that apply WAP standards can access the Internet, including sending and receiving emails, querying information, and accessing websites.

How to jump to the details page in phpcms How to jump to the details page in phpcms Jul 27, 2023 pm 05:23 PM

How to jump to the details page in phpcms: 1. Use the header function to generate a jump link; 2. Loop through the content list; 3. Get the title and details page link of the content; 4. Generate a jump link.

What framework is phpcms? What framework is phpcms? Apr 20, 2024 pm 10:51 PM

PHP CMS is a PHP-based open source content management system for managing website content. Its features include ease of use, powerful functionality, scalability, high security, and free open source. It can save time, improve website quality, enhance collaboration and reduce development costs, and is widely used in various websites such as news websites, blogs, corporate websites, e-commerce websites and community forums.

WeChat Login Integration Guide: PHPCMS Practical Combat WeChat Login Integration Guide: PHPCMS Practical Combat Mar 29, 2024 am 09:18 AM

Title: WeChat Login Integration Guide: PHPCMS in Action In today’s Internet era, social login has become one of the essential functions of a website. As one of the most popular social platforms in China, WeChat’s login function is also used by more and more websites. This article will introduce how to integrate the WeChat login function in the PHPCMS website and provide specific code examples. Step 1: Register a WeChat Open Platform Account First, we need to register a developer account on the WeChat Open Platform and apply for the corresponding development permissions. Log in [WeChat open platform]

Isn't phpcms free? Isn't phpcms free? Mar 01, 2023 am 10:24 AM

phpcms is not completely free. phpcms is an open source cms system, but open source does not mean free. It has two versions: free version and commercial version. The free version is limited to personal non-commercial use, while the commercial version requires purchasing a license; individuals can use it for research, and if it is commercial application , you need to pay a certain fee.

What does phpcms mean? What does phpcms mean? Apr 20, 2024 pm 10:39 PM

PHPCMS is a free and open source content management system (CMS) that features: open source, modularity, flexibility, user-friendliness and community support. It can be used to create various types of websites, including corporate websites, e-commerce websites, blogs, and community forums. Technical requirements include: PHP 5.6 or higher, MySQL, MariaDB or PostgreSQL database, and Apache or Nginx web server.

What versions of phpcms are there? What versions of phpcms are there? Jun 14, 2023 pm 01:13 PM

There are two well-known versions of phpcms, namely: 1. phpCMS4, which supports custom URL rules. The website management background is beautiful and easy to use, and has many front-end plug-ins, which can freely expand functions; 2. phpCMS2008R1, which supports multi-language, multi-site management, and page The manager is convenient, flexible, very lightweight, and runs fast.

What database does phpcms use? What database does phpcms use? Feb 21, 2023 pm 06:57 PM

phpcms uses mysql database. phpcms is a PHP open source website management system, developed using PHP+MYSQL as the technical basis. PHPCMS V9 adopts OOP method to build the basic operating framework. The supported PHP version is PHP5 and above, and the supported MYSQL version is MySql 4.1 and above.

See all articles