Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Createing WAP/WML Pages with PHP

    I'm attempting to learn how to create some WML pages to view on a Smartphone, and came across this website Here in attempting to get started.

    Well, the site shows to create this file as sample/test page. However, when I pull up my test page on my Smartphone, I get an error on line 4. I'm still fairly new at php, so if anyone can help, it would be great.

    Code:
    <?php
    // send wml headers
    header("Content-type: text/vnd.wap.wml");
    echo "<xml version="1.0"?>";
    echo "<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN""
    . " "http://www.wapforum.org/DTD/wml_1.1.xml">";
    ?>
    
    <wml>
      <card id="card1" title="Example 1">
        <p>
        <?php
        // format and output date
        $the_date = date("M d Y");
        print $the_date;
        print "<br/>Welcome to a PHP WAP-enabled site!";
        ?>
        </p>
      </card>
    </wml>

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You need to escape the quotes in the strings

    echo "<xml version=\"1.0\"?>";

    or change the quotes to single quotes (if they're called that)

    echo '<xml version="1.0"?>';

    Also need to do the same on the lines below too

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you have short tags on you'll also need to seperate the ?> within the echo

    echo '<'.'?xml version="1.0"?'.'>';
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •