Using PHP with Mobile XHTML

Using PHP with Mobile XHTML

By on May 2, 2006

Mobile XHTML is the best markup language for mobile browsers as opposed to WAP. XHTML, however, does have limitations which can be solved by dynamic scripting. If you renamed the page’s extension from html to php, the page will not display in a mobile browser. I spent a great deal of time searching the Internet for a solution and not one site could help me. After some thought, I discovered how to create a mobile PHP page.

A Mobile XHTML page has 2 HTML tags at the start of the page. If you remove these tags, the page will not display correctly. A PHP page must begin with the following bit of code in order to display:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "">

This code must appear at the very beginning of the PHP page before the HTML tag. From there, you can use any PHP function available.