WAP and <? tag

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Drizzt

    WAP and <? tag

    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.or g/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.


  • Ian.H

    #2
    Re: WAP and &lt;? tag

    On Mon, 29 Mar 2004 22:02:53 +0000, Drizzt wrote:
    [color=blue]
    > 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.or g/DTD/wml_1.1.xml\">\ n\n"); ?>[/color]
    [color=blue]
    > But I'd like to know if there is a bettere way to do this...
    >
    >
    > Thx in advance.[/color]


    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.or g/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


    Comment

    • Ian.H

      #3
      Re: WAP and &lt;? tag

      On Mon, 29 Mar 2004 22:50:50 +0000, Ian.H wrote:


      [ snip ]

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


      [ 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


      Comment

      • Andy Hassall

        #4
        Re: WAP and &lt;? tag

        On Mon, 29 Mar 2004 22:55:12 GMT, "Ian.H" <ian@WINDOZEdig iserv.net> wrote:
        [color=blue]
        >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.[/color]



        --
        Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
        http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

        Comment

        • Garp

          #5
          Re: WAP and &lt;? tag

          "Drizzt" <drizzt.du@libe ro.it> wrote in message
          news:h21ac.1192 63$z23.5094915@ news3.tin.it...[color=blue]
          > 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.or g/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.[/color]

          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


          Comment

          Working...