homepage Welcome to WebmasterWorld Guest from 54.242.126.9
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
Forum Library, Charter, Moderators: bakedjake

Smartphone, Wireless, and Mobile Technologies Forum

    
Why does page.php come up blank?
XHTML, XML, PHP issue
vertex42

5+ Year Member



 
Msg#: 3482897 posted 8:13 pm on Oct 20, 2007 (gmt 0)

I have spent hours trying to figure out why the following page, saved as xhtmlexample.php, comes up blank when viewed in any browser:


<?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">
<head>
<title>Page Title</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta http-equiv="Cache-Control" content="max-age=600" />
<meta http-equiv="content-type" content="application/xhtml+xml" />
</head>
<body>
<?php include 'inc_header.php'?>
<h1>Page Heading</h1>
<p>Page Content</p>
<p><?php echo "PHP-generated Content";?></p>
</body>
</html>

This example was taken from the dotMobi Mobile Web Developers Guide, and as far as I can tell, the page should be valid. Perhaps it is a server issue?

Note: If I remove the first line (<?xml ...?>) then it displays just fine and validates on ready.mobi with a 5 rating.

Any ideas?

 

encyclo

WebmasterWorld Senior Member encyclo us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3482897 posted 8:21 pm on Oct 20, 2007 (gmt 0)

Welcome to WebmasterWorld vertex42! Sounds like you have PHP short tags enabled, allowing
<? as well as <?php to delimit PHP code. As such, the XML prolog causes an error.

You should either disactivate short tags, or echo the XML prolog:

<?php echo '<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n';?>

vertex42

5+ Year Member



 
Msg#: 3482897 posted 10:06 pm on Oct 20, 2007 (gmt 0)

Thank you! That worked, except that I used
<?php echo '<?xml version="1.0" encoding="UTF-8"?>';?>

This was certainly worth the $149 subscription.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved