On Mon, 29 Mar 2004 22:02:53 +0000, Drizzt wrote:
Hi all.
I'm a somehow rusty on PHP, so maybe this is a dumb question... I'm
playing a bit with WAP developing, and found a simple problem right at
the beginning.
All the WAP pages that the editor (WAPTor) generate begin with <?xml
version="1.0"?>
That, <? is also the PHP tag for the beginning of the PHP scripting...
I've solved with this:
<?
echo("<?xml version=\"1.0\"?>\n");
echo("<!-- created by WAPtor (http://www.wapdrive.net/) -->");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n\n"); ?>
But I'd like to know if there is a bettere way to do this...
Thx in advance.
I did much searching on this a year or so ago. I think your solution
appears to be similar to the one I used back then too, although I
specified a header also:
<?php
header('Content-type: text/vnd.wap.wml');
echo <<<WAP
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
WAP;
?>
<wml>
[...]
</wml>
Personally I prefer the Heredoc[1] method for multiple echo lines like
this.. but the results are the same =)
I don't know of any other way. I tried reconfiguring apache and add .wml
as a PHP handled file but this caused all sorts of other issues (I forget
the exact problems now).
Note however.. I also use the full opening '<?php' tag rather than the
short tag. I strongly suggest working in this manner too as it will
prevent some issues with XML and PHP tags.
Regards,
Ian
--
Ian.H
digiServ Network
London, UK
http://digiserv.net/