Using PHP with Mobile XHTML

Posted by Johan Cyprich on 02 May 2006 | Tagged as: Programming

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:

echo '‘;
echo ‘ echo '"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">‘;

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.


Related posts:
    Is There Gold in Them There Cell Phone Hills?
    Windows Vista in Your Pocket

Share this post:

del.icio.us:Using PHP with Mobile XHTML digg:Using PHP with Mobile XHTML spurl:Using PHP with Mobile XHTML wists:Using PHP with Mobile XHTML simpy:Using PHP with Mobile XHTML newsvine:Using PHP with Mobile XHTML blinklist:Using PHP with Mobile XHTML furl:Using PHP with Mobile XHTML reddit:Using PHP with Mobile XHTML fark:Using PHP with Mobile XHTML blogmarks:Using PHP with Mobile XHTML Y!:Using PHP with Mobile XHTML smarking:Using PHP with Mobile XHTML magnolia:Using PHP with Mobile XHTML segnalo:Using PHP with Mobile XHTML gifttagging:Using PHP with Mobile XHTML

Follow Me:

Did you find this post interesting and useful? You can keep up to date on this blog by subscribing to my RSS feed, or you can have new posts sent to you by e-mail. You can also follow me on Twitter.


2 Responses to “Using PHP with Mobile XHTML”

  1. on 06 Nov 2006 at 6:10 am 1.m1dp1d said …

    Hallo Admin!

    I’m a mobile device developer and I have exactly the same problem you’ve been talking about on 02 May 2006. You are one of few who’s addressing this problem. But unfortunately I’m still not able to display any php file on diverse SDK’s. (Openwave, Nokia, …). Can you please give me some additional advice/help how to create pages with php content.

    It doesn’t work if I create a file with the file extension *.php that has the following content:

    ‘;
    echo ”;
    ?>

    In another forum I was told to use the following code as a header:

    header(’Content-Type: application/xhtml+xml;’);

    Thanks in advance

  2. on 06 Nov 2006 at 12:43 pm 2.admin said …

    Can you resend the code that you are having trouble with? A problem with WordPress is that it filters out PHP code from messages. I just installed a plug-in which will allow you to place PHP a message. You need to enclose your code in code or pre HTML tags.

    I already have a moble PHP web site that you can try (mobile.holysouls.info). I haven't updated the site with the latest content yet, but it definitely works on my Nokia 3100.

Trackback This Post |