|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Can't serve XHTML-MP with PHP
I can get an index.xhtml file to work which is valid XHTML-MP. However, when I change the extension to .php it give 500 internal server error.
I tried to set the header to both the XHTML-MP headers and the standard XHTML headers and no luck with either attempts. Could this mean that my server does not support the XHTML-MP MIME type? I know that XHTML works on my server and I think that XHTML-MP is a subset of XHTML so shouldn't it work if I serve it as XHTML. Can anyone help me with this? Thanks! My site is at http://mobi.randomthoughts.ws/ Sample XHTML page works OK: http://mobi.randomthoughts.ws/index.xhtml
__________________
Random Thoughts | Software Engineer - Boston, MA | PHP Developer - Boston, MA | Binding Designs, LLC |
|
#2
|
|||||
|
|||||
|
I get a blank page, absolutely no output on http://mobi.randomthoughts.ws
For the index.xhtml page, you should add the following within the <head> of the document: html4strict Code:
As for your 500 error: Have you made any changes to .htaccess or server? Can you use PHP normally?
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure # Any form of employment is strictly prohibited ...... __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. __________________ |
|
#3
|
|||
|
|||
|
I have no problems with using PHP on my server...many, many PHP files are working flawlessly.
The XHTML-MP checks out: http://validator.w3.org/check?uri=h...=Inline&group=0 Here is my PHP file that I am trying to execute: Code:
<?PHP
header('Content-type: application/vnd.wap.xhtml+xml');
?><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>City Guide</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<p>
<img src="meal.gif" alt=""/><b>Restaurants:</b><br/>
Your current location is Market Street, San Francisco.<br/>
Choose restaurants within 1 mile:
</p>
<table>
<tr class="blue">
<td><p class="nowrap">1 <a accesskey="1" href="find.html">American (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">2 <a accesskey="2" class="bluetext" href="find.html">Chinese (2 Restaurants)</a></p></td>
</tr>
<tr class="blue">
<td><p class="nowrap">3 <a accesskey="3" href="find.html">Frence (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">4 <a accesskey="4" class="bluetext" href="find.html">Italian (2 Restaurants)</a></p></td>
</tr>
<tr class="blue">
<td><p class="nowrap">5 <a accesskey="5" href="find.html">Japanese (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">6 <a accesskey="6" class="bluetext" href="find.html">Mexican (2 Restaurants)</a></p></td>
</tr>
</table>
<p><a class="darkblue" href="more.html">More</a>
</p>
</body>
</html>
Do I need to have MIME type for XHTML-MP installed in PHP? I've never dealt with that before. |
|
#4
|
||||
|
||||
|
No you shouldn't have to.
Have you tried echoing the XML declaration - if PHP has short tags enabled it can get confused. Saying that, don't know why you get a 500 error - that should throw a parse error.. Would question your use of tables in this instance, but that is another issue.. Last edited by jabba_29 : April 17th, 2008 at 10:08 AM. |
|
#5
|
|||
|
|||
|
Cool. Here is a working PHP template to output XHTML-MP. It is validated here http://validator.w3.org/check?uri=http%3A%2F%2Fmobi.randomthoughts.ws%2F&charset=%28detect+automatically%29&doctype=Inline&group=0
I am not using the: header('Content-type: application/vnd.wap.xhtml+xml'); for now so I can test it in the browser. Should I use that later on? I have seen a couple of articles on HTTP_ACCEPT to test whether the browser will accept it or not. IE tries to "open" the XHTML files. FF can handle it appropriately. This is just a template that has nothing to do with my website, but I am going to get the content now and fill in this little template. I will post back once I get the PHP running in this template, validate it through W3C, and test it on a couple of mobile phones. Does anybody have any "gotchas" that I should be weary about like this one for what I am doing? Code:
<?php
// header('Content-type: application/xhtml+xml');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>City Guide</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<p>
<img src="meal.gif" alt=""/><b>Restaurants:</b><br/>
Your current location is Market Street, San Francisco.<br/>
Choose restaurants within 1 mile:
</p>
<table>
<tr class="blue">
<td><p class="nowrap">1 <a accesskey="1" href="find.html">American (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">2 <a accesskey="2" class="bluetext" href="find.html">Chinese (2 Restaurants)</a></p></td>
</tr>
<tr class="blue">
<td><p class="nowrap">3 <a accesskey="3" href="find.html">Frence (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">4 <a accesskey="4" class="bluetext" href="find.html">Italian (2 Restaurants)</a></p></td>
</tr>
<tr class="blue">
<td><p class="nowrap">5 <a accesskey="5" href="find.html">Japanese (2 Restaurants)</a></p></td>
</tr>
<tr>
<td><p class="nowrap">6 <a accesskey="6" class="bluetext" href="find.html">Mexican (2 Restaurants)</a></p></td>
</tr>
</table>
<p><a class="darkblue" href="more.html">More</a>
</p>
</body>
</html>
|
|
#6
|
||||
|
||||
|
Gotchas:
- tables - you should send as "application/xhtml+xml" if the device can handle it. However, invalid code (tag soup) will break the page and it may not display. Check out http://dev.mobi for more tips... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > Can't serve XHTML-MP with PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|