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 ‘‘;
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: | |
|
|
Share this post:
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 Comments »
















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
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.