Results 1 to 12 of 12

Thread: wml simple question

  1. #1
    Join Date
    Aug 2008
    Location
    malaysia
    Posts
    31
    Rep Power
    0

    wml simple question

    Hi..i'm new to wml.
    I read about whit3_cryst4l problem which i face as well. I hope someone can help me here.

    I want to ask and confirm :
    1. Can i build the wml script using notepad?

    2. The script i save will have *.wml?

    3. If i save the script in root folder www as i'm using wamp2 with apahce, php and mysql.
    Is it wrong?

    4. I try to view the output using smart phone browser emulator. But it didn't show anything.

    5. If i open with localhost/.../abc.wml , it will only show my script.

    Thanks!

    Regard
    Areah

  2. #2
    Join Date
    Mar 2008
    Location
    pd
    Posts
    497
    Rep Power
    152
    Does your .wml file contain WML or PHP?

    If it's PHP, you should probably save it as a .php file. If you see the contents of a file rather than the output of script when it has been served by Apache, then you haven't told Apache that .whatever files must be processed by a script processor.

    For PHP, you'd have something like:

    Code:
    LoadModule php5_module        modules/libphp5.so
    AddHandler php5-script php

    in your httpd.conf

    The LoadModule directive loads the script processor, the AddHandler maps file extension onto the appropriate processor.

  3. #3
    Join Date
    Aug 2008
    Location
    malaysia
    Posts
    31
    Rep Power
    0
    I save the file as .php as i thought i can try to open it with iexplore. I tried to save it as .wml as well and download WinWAP Smartphone Browser Emulator to view the script. But it didn't work.

    I opened my http.conf file and search for LoadModule php5_module modules/libphp5.so. However what i found was LoadModule php5_module "c:/wamp/bin/php/php5.2.6/php5apache2_2.dll". I can't find AddHandler php5-script php.

  4. #4
    Join Date
    Aug 2008
    Location
    malaysia
    Posts
    31
    Rep Power
    0
    I tried to ask one of my friend and he gave me this answer which i really can't understand. Below was the answer he gave me.
    __________________________________________________ _________________
    When the page is served up the http headers will say which mime type the document has and the browser should render it appropriately.
    I suspect the mime-type mappings may not be set up for *.wml and the document is probably being served up as something like text/text

    not sure where htdocs are on wamp, it will depend on the installation

    there should be a httpd.conf config file for apache somewhere with the DocumentRoot and a pointer to a file containing the mime type mappings
    MIME = Multipurpose Internet Mail Extensions


    When you ask for a document from a web server, the web server will pass back a http header which has info about the document it's giving you back. Normally the web browser uses this and you don't see it
    It's possible to telnet into port 80 on the web browser, issue the http commands by hand, ans see the response

    one part of this is the Content-Type
    this is the mime type
    the mime type for HTML is "text/html"

    tht mime type for WML is "text/vnd.wap.wml"
    As the web server (apache in this case) serves the document back and tells the browser what the Content-Type is, you need to tell apache that the document is wml or it will assume it's normal text

    With PHP you will have to tell apache what mime type the output is as there is no actual filename.

    If it's a static WML file you'll need to put it in the mime.types file
    This website may help

    You'll need to find out where the mime.type file is though (doing a file search may be a quick way)

    If you're building the wml via something like PHP, the PHP can issue a command to tell apache what the mime type is
    This is done with the php "header" command

    With PHP you will have to tell apache what mime type the output is as there is no actual filename.
    e.g. header('Content-type: text/vnd.wap.wml');

    oh...
    so how does the php know what type of file it is?

    With PHP you are generating the content using PHP code... when you write the PHP program you will know what sort of content you are outputting: text, html, wml or whatever

    So if I write a PHP program which created some fancy dynamic web page, I would know that it's html being output, so I would code in the header command to set the content type to text/html

    If the PHP program output was WML, I would do the same, but the set the output to text/vnd.wap.wml

    If my program was generating graphics I might output image/gif as the mimetype
    and so on
    __________________________________________________ ________________
    Quote Originally Posted by hymns View Post
    nape php? ehe php wap bleh tgk gak... kengkadang tu laie best pakai ext. php nih tapi kat atas sekali tu kene le letak menatang nih....

    <?php
    //daftar.php
    header("Content-type: text/vnd.wap.wml");
    echo "<?xml version=\"1.0\"?>";
    ?>
    ....code wml kat sini....


    kalau webserver hang support wml extension baru leh save cam nih...

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

    aha... kalau tak dia d/l menatang tu... kat apache setting skit dia punya mime... htdoc.conf

    cenginih ler....
    **********************************************

    # MIME Types for WAP

    # php4 ke atas
    AddType application/x-httpd-php .wml

    # php3 je:
    AddType application/x-httpd-php3 .wml

    # utk wml
    AddType text/vnd.wap.wml .wml

    # nih gambo
    AddType image/vnd.wap.wbmp .wbmp
    **********************************************
    I tried the php header mentioned by hymns. But, it can't work as well. Do i need to open my MIME files and add :
    AddType application/x-httpd-php .wml ?

  5. #5
    Join Date
    Nov 2001
    Location
    Johor
    Posts
    772
    Rep Power
    234
    Quote Originally Posted by areah View Post
    I tried to ask one of my friend and he gave me this answer which i really can't understand. Below was the answer he gave me.
    __________________________________________________ _________________
    When the page is served up the http headers will say which mime type the document has and the browser should render it appropriately.
    I suspect the mime-type mappings may not be set up for *.wml and the document is probably being served up as something like text/text

    not sure where htdocs are on wamp, it will depend on the installation

    there should be a httpd.conf config file for apache somewhere with the DocumentRoot and a pointer to a file containing the mime type mappings
    MIME = Multipurpose Internet Mail Extensions


    When you ask for a document from a web server, the web server will pass back a http header which has info about the document it's giving you back. Normally the web browser uses this and you don't see it
    It's possible to telnet into port 80 on the web browser, issue the http commands by hand, ans see the response

    one part of this is the Content-Type
    this is the mime type
    the mime type for HTML is "text/html"

    tht mime type for WML is "text/vnd.wap.wml"
    As the web server (apache in this case) serves the document back and tells the browser what the Content-Type is, you need to tell apache that the document is wml or it will assume it's normal text

    With PHP you will have to tell apache what mime type the output is as there is no actual filename.

    If it's a static WML file you'll need to put it in the mime.types file
    This website may help

    You'll need to find out where the mime.type file is though (doing a file search may be a quick way)

    If you're building the wml via something like PHP, the PHP can issue a command to tell apache what the mime type is
    This is done with the php "header" command

    With PHP you will have to tell apache what mime type the output is as there is no actual filename.
    e.g. header('Content-type: text/vnd.wap.wml');

    oh...
    so how does the php know what type of file it is?

    With PHP you are generating the content using PHP code... when you write the PHP program you will know what sort of content you are outputting: text, html, wml or whatever

    So if I write a PHP program which created some fancy dynamic web page, I would know that it's html being output, so I would code in the header command to set the content type to text/html

    If the PHP program output was WML, I would do the same, but the set the output to text/vnd.wap.wml

    If my program was generating graphics I might output image/gif as the mimetype
    and so on
    __________________________________________________ ________________


    I tried the php header mentioned by hymns. But, it can't work as well. Do i need to open my MIME files and add :
    AddType application/x-httpd-php .wml ?
    If you using wap 1.0 make sure your image file is wbmp format (black only)

    Currently most new phone browser support wap 2.0 (html) like opera.

    * Have you restart your webserver/apache after add the
    addtype .. ? Make sure restart back your apache.
    I hate when:

    vBulletin Message:
    Sorry! The administrator has specified that users can only post one message every 60 seconds

  6. #6
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    279
    Honestly.. here's my humble opinion..

    It's really a big dilemma now... I once wanted to make it too (wap site).. BUT!

    Wap site getting obsolete and out of date , WHY?
    Because it's 3G era, coming soon 4G era.. and 3G phone not exspensive like hell nowaday.. Even hi-school students have it!...

    So why WAP? peoples nowadays use 3G, as fast as it is (not so fast hehe) and full color just like browser!... (oh yeah! maxis tv ads + opera mini ) DaNG!!!! Even can browse youtube and download 3GP melayu bolehsomemore again.. (Oh damn.. im such a damned.. )

    If your oldskool boss told you to do so (WAP site,) You bash and CONSULT (or insult) him like what i told you here.

    So you must think again, not twice but 10th times..
    Last edited by mysticmind; 09-08-2008 at 05:23 PM.

  7. #7
    Join Date
    Nov 2001
    Location
    Johor
    Posts
    772
    Rep Power
    234
    Quote Originally Posted by mysticmind View Post
    Honestly.. here's my humble opinion..

    It's really a big dilemma now... I once wanted to make it too (wap site).. BUT!

    Wap site getting obsolete and out of date , WHY?
    Because it's 3G era, coming soon 4G era.. and 3G phone not exspensive like hell nowaday.. Even hi-school students have it!...

    So why WAP? peoples nowadays use 3G, as fast as it is (not so fast hehe) and full color just like browser!... (oh yeah! maxis tv ads + opera mini ) DaNG!!!! Even can browse youtube and download 3GP melayu bolehsomemore again.. (Oh damn.. im such a damned.. )

    If your oldskool boss told you to do so (WAP site,) You bash and CONSULT (or insult) him like what i told you here.

    So you must think again, not twice but 10th times..
    agree!

    go mystic go! hahaha
    I hate when:

    vBulletin Message:
    Sorry! The administrator has specified that users can only post one message every 60 seconds

  8. #8
    Join Date
    Dec 2007
    Location
    Manchester, UK
    Posts
    8
    Rep Power
    0
    WAP is dead, just use xhtml, it's fine.

  9. #9
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    279
    wap is dead - Google Search

    2008 declared.. WAP IS DEAD..
    (even since 2007) Yess.. 2003 wap still alive..
    Forward that google search result to your boss or your stupid lecturer perhaps (most lecturer out dated also.. i knew this!)..

    You also can print this page, and give him/her.

    I might be RUDE, but truly honest..

    Good luck.

  10. #10
    Join Date
    Aug 2008
    Location
    malaysia
    Posts
    31
    Rep Power
    0
    My lecturer asked to use wml (which i know it's really outdated and i can not find any book regarding wml in my college library) because he wanted user without high technology handphone can browse our site as well. Furthermore, wml doesn't have any graphics hence will be fast to browse through the page.

    Here i created some scripts which have errors and i can't really solve them until now.

    test1.php
    //send wml headers
    <?php
    Header("Content-type: text/vnd.wap.wml");
    Header("Cache-Control: no-cache, must-revalidate");
    Header("Pragma: no-cache");
    echo ("<?xml version='1.0'?>");
    ?>

    //begin wml
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

    <wml>
    <card id="homepage" title="Homepage">

    <p mode="nowrap" align="center"><strong> Welcome to </strong></p>
    <p mode="nowrap" align="center"><strong> Our Site </strong></p>

    <br><p> Already a registered user, </p>
    <p> click <anchor> here <go href="test2.php"/></anchor> to login </p>

    <br> Sign Up for Our Site now?
    <p> Click <anchor> here <go href="test3.php"/></anchor> to register. </p>

    </card>
    </wml>


    test2.php
    <?php

    Header("Content-type: text/vnd.wap.wml");
    Header("Cache-Control: no-cache, must-revalidate");
    Header("Pragma: no-cache");
    echo ("<?xml version='1.0'?>");
    ?>

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

    <wml>
    <card id="login" title="Login">

    <p> Login below by supplying your Login ID and password.
    <br/><br/>


    <p> Login ID: <input name="myloginid" format="*N" value=""/>
    <p> Password: <input name="mypassword" type="password" value=""/>

    <br/><br/>
    <p>
    <anchor>
    <go method="post" href="test3.php">
    <postfield name="user" value="$(myloginid)"/>
    <postfield name="pass" value="$(mypassword)"/>
    </go>
    Submit
    </anchor>
    </p>

    <p mode="nowrap" align="center"><anchor> Home <go href="test1.php"/></anchor></p>

    </card>
    </wml>


    test3.php
    <?php

    Header("Content-type: text/vnd.wap.wml");
    Header("Cache-Control: no-cache, must-revalidate");
    Header("Pragma: no-cache");
    echo ("<?xml version='1.0'?>");
    ?>


    <?php
    include "connect_to_MySQL.php";
    $mylogin_id = $_POST["user"] ;
    $password = $_POST["pass"] ;

    if (isset($_POST["submit"]))
    {
    $query="SELECT * FROM reginfo WHERE Login_id = '". $mylogin_id ."' and Pass='". $password ."'";
    $result=mysql_query($query) or die(mysql_error());

    $count=mysql_num_rows($result);

    // If result matched $query
    if($count==1)
    {
    session_start();


    //session_register Register $myusername, $mypassword with the current session and redirect to file "login_success.php
    //session_register('mylogin_id');
    //session_register('mypassword');
    $_SESSION['user_logged']=$_GET["mylogin_id"];
    $_SESSION['password_logged']=$_GET["password"];



    $mylogin_id = stripslashes($mylogin_id);
    $mypassword = stripslashes($mypassword);
    $mylogin_id = mysql_real_escape_string($mylogin_id);
    $mypassword = mysql_real_escape_string($mypassword);

    ?>



    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

    <wml>
    <card id="login_success" title="Login "Success>



    Please select link below for services:
    <p> <anchor> My profile <go href="myprofile.php"/></anchor> </p>
    <p> <anchor> Logout <go href="logout.php"/></anchor> </p>

    <p mode="nowrap" align="center"><anchor> Home <go href="test1.php"/></anchor> </p>

    </card>
    </wml>

    <?php
    }

    else
    {
    ?>


    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

    <wml>
    <card id="login_error1" title="Login Error">

    <p> Error : Invalid Username and/or Password </p>
    <p> Insert the correct Login ID and Password in the form provided. </p>

    <br>
    <p> Click <anchor> here <go href="test1.php"/></anchor> to direct to main menu and login again. </p>
    <p> Thank you! </p>
    </br>

    <p mode="nowrap" align="center"><anchor> Home <go href="test11.php"/></anchor></p>

    </card>
    </wml>



    <?php
    }

    }



    else
    {
    ?>
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

    <wml>
    <card id="login_error2" title="Login Error">

    <p> Error : The form is empty </p>
    <p> Insert the correct Login ID and Password in the form provided. </p>

    <br>
    <p> Click <anchor> here <go href="yessy1.php"/></anchor> to direct to main menu and login again. </p>
    <p> Thank you! </p>
    </br>

    <p mode="nowrap" align="center"><anchor> Home <go href="yessy1.php"/></anchor></p>
    </card>
    </wml>


    <?php
    }

    ?>

    The problem is whatever input is submit, the output will be only the last output which is say that the form is empty.
    Can someone checked out for me? Thanks!

  11. #11
    Join Date
    Mar 2008
    Location
    pd
    Posts
    497
    Rep Power
    152
    Can someone checked out for me?
    No.

    That's a lot of code. It wouldn't matter where you posted it, nobody would want to put in so much effort. When you're struggling to understand why something won't work as you expect it to, the best next thing to do is to make a copy of it all, and strip it down to a minimal example that contains only the feature that's not working as you expect. If that still doesn't work, then that's the code you could post to a public forum.

    If it does work, you can add in your extra code a line at a time to see what causes it to break. If you still don't see why it breaks, try stripping out all the code you added between the one that caused it to break and your minimal example. If you still can't see why it breaks, you could submit that version to a public forum too.

    Actually the answer isn't simply 'no' - you might always find somebody who's prepared to 'go the extra mile' and look at a problem with extraneous code in it. But you'd have better luck with a smaller example, I reckon.

    Looking at your code, it seems like your problem is somewhere between test2 and test3, test1 isn't really relevant - is it? Try to come up with a single file example. I think login pages commonly contain both prompt code and success / fail code - success causing a redirect to be sent to the browser.

    And this is really a new topic, compared to your original question...

  12. #12
    Join Date
    Aug 2008
    Location
    malaysia
    Posts
    31
    Rep Power
    0
    Thank you for your suggestion. I will try again and if i still have problem, i will post it in new thread.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Simple PHP - Learn PHP
    By gimmebucks in forum Website Programming
    Replies: 0
    Last Post: 12-02-2009, 04:15 PM
  2. Simple Map Geocoder
    By soonx in forum Websites Review and Suggestion
    Replies: 2
    Last Post: 21-12-2007, 10:28 AM
  3. my simple blog
    By sazs212 in forum Showcase
    Replies: 8
    Last Post: 21-02-2007, 10:05 AM
  4. Simple website - USD 10,000 per day in adsense
    By jawa in forum Revenue and Monetization
    Replies: 6
    Last Post: 25-07-2006, 05:14 AM

Posting Permissions

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

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32