By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

WAP and <? tag

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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/

Jul 17 '05 #2

P: n/a
On Mon, 29 Mar 2004 22:50:50 +0000, Ian.H wrote:
[ snip ]

Personally I prefer the Heredoc[1] method for multiple echo lines like
this.. but the results are the same =)

[ snip ]
Oops..

[1]: <<<TEXT is known as Heredoc in Perl (but Perl uses 2 << chars).. I
don't know if the reference differs for PHP.. I've never checked to find
out if the name is the same for this method.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #3

P: n/a
On Mon, 29 Mar 2004 22:55:12 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net> wrote:
On Mon, 29 Mar 2004 22:50:50 +0000, Ian.H wrote:

[1]: <<<TEXT is known as Heredoc in Perl (but Perl uses 2 << chars).. I
don't know if the reference differs for PHP.. I've never checked to find
out if the name is the same for this method.


http://www.php.net/manual/en/languag...syntax.heredoc

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #4

P: n/a
"Drizzt" <dr*******@libero.it> wrote in message
news:h2**********************@news3.tin.it...
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.


In addition to the other responses, I'd like to propose the ever-popular
Smarty template library, which would enable you to concentrate on the data
acquisition and worry less about tactics for getting around syntax.

Garp
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.