WML Coding For Newbies!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    WML Coding For Newbies!

    WML TUTORIAL: Please note that this tutorial is for newbie coders.

    Here is an example code of WML, please note that this code is very important, you have to make use of it everytime you create a WML document/page.


    Code:
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <wml>
    <card>
    
    
    
    Hello World!
    </p>
    </card></wml>
    Apart from the Hello World part, everything is mandatory; the first line tells us this is an XML document - eXtensible Markup Language, a group of HTML-like languages of which WML is part - the second line is where to find the specification of this particular variety of XML (wml_1.1, stored on the WapForum website). Notice how the DOCTYPE line is mostly in capitals to start with, all this has to be shown case and all!
    Then we have the <wml> and <card> tags, which is the start of some actual WML, and so are closed again at the bottom of the deck.
    Now copy and paste the above code and save the file as test.wml open it with winwap browser or upload it to your server, then direct your browser to the url eg http://yourdomain/test.wml ...
    Thats it for your first wml page
    ...........................

    Now lets move on to something a little more advanced. Advanced? lol its not advanced at all its pretty simple, the following tutorial will teach you how to "align" your text in ur document/page.
    *ALIGN = left, center, right
    *MODE = wrap, nowrap
    As there are no other alignment tags - no <center>...</center> you&#39;ll need to use paragraph alignment to center text. To stop centering you&#39;ll need to close the paragraph and open a new one, as in the followinf example:


    Code:
    <p align="center">
    Welcome!
    </p>
    <p align="left">
    Hello and welcome to my website!
    </p>
    As you can see the HEADER and FOOTER stuff is NOT included as i would like to keep this simple, but if you were to compile this code on a fresh piece of page, you have to include the HEADER(1st tutorial) and FOOTER... Note that if you do not wish to align your text to center or right the default implied alignment will be left and you do not have to specify this in your code.
    The mode attribute has two possible values, wrap and nowrap. wrap is, as you might expect, just the standard way that text will go to the end of the line and then drop down to carry on at the beginning of the next line. nowrap however allows you to only take up one line; it&#39;ll show a line&#39;s worth of text, and when you move down so that the line has "focus" then it&#39;ll do a strange jump to the next line&#39;s worth of text, and then the next line&#39;s worth, and then the next in a kind of strange scroll text effect (although a scroll text usually scrolls a pixel or a character at a time, not whole words). This could be useful for a list of links, for example, so that you can show a concise list on screen, but as the user scrolls down it they get a longer description.
    ................

    Now to add some EFFECTS to your page
    * bold
    * Italic
    * underline
    * emphasised
    * strongly emphasised
    *<big></big> big
    * small
    You may have notice that all the effects are exactly the same as in HTML. However some devices do not have support for effects but not to worry this will not display an error when a certain device with no effects support try to access your page, it will just ignore it and display normal fonts.


    Code:
    <p align="center">
    <big>[b]Welcome[/b]</big>
    </p>
    <p align="left">
    Hello and Welcome to my website!
    </p>
    The bold and big tags together with the centering will make the headline - "Welcome!" - stand out more; even if the big tag isn&#39;t supported at least there&#39;s the boldness to fall back on, and if for some reason this doesn&#39;t work it should be centered.
    ............

    Now for the next code we going to add some pics to your page
    IMAGES
    *<img />attributes:
    *src= filename
    *alt= alternative text incase image can&#39;t be shown
    *height = height in pixels of image
    *width = width in pixels of image
    *hspace = horizontal border width
    *vspace = vertical border width
    As you can see there is no real suprises with the image tag - apart from that closing slash at the end of the tag it&#39;s pretty much identical to HTML. You can even have an alignment tag to align the image to the top, middle or bottom. One thing to watch out for though is that, apart from the src attribute which you obviously need to tell the browser where to load the image from, you must have an alt attribute - even if it&#39;s empty, as in alt="" - otherwise some phones will throw up an error. Remeber most phones have small screens therefore u have to keep ur images down to about 96x40 pixels in size or 100x50 alot of the new phones will be able to handle images of 200 or above, but lets keep it simple...


    Code:
    <p align="center">
    img src="4.wbmp" alt="Welcome!"/>
    </p>
    <p align="left">
    Hello and Welcome to my website!
    </p>

    Now for the most important thing in your document/page is LINKING. A hypertext document woudn&#39;t be complete without HYPERLINKING, and you&#39;ll be glad to know that a WML link is the same as a simple HTML link - example:


    Code:
    [url="destination.file"]Some Text[/url]
    It&#39;s even possible to have images in links, as in this example:


    Code:
    [url="index2.wml"][img]banner.wbmp[/img][/url]
    However you cannot have other tags inside links, for example the following will generate an error:

    Code:
    [url="index2.wml"]<big>[b]This will fail![/b]</big>[/url]
    Now for an auto redirect ontimer in your page


    Code:
    <wml><card title="test 2" ontimer="http://zeroacid.yakom.net/home.wml">
    <timer value="50" />
    
    
    
    Please wait five seconds or
    [url="http://zeroacid.yakom.net/home.wml"]Click here[/url]
    to go to[b]zeroacid forums[/b]
    </p>
    </card></wml>
    Notice that the timer is set for 50, but the text says that the jump will occur in five seconds; this is because the timer is set in tenths of a second, so setting the timer to 5 would only be half a second.

    BACK BUTTON:
    There&#39;s one other navigation link that you might want to add to your card, which goes just outside the closing </p> right near the end - you can add a back button to either one of the phone&#39;s keys, and/or the navigation menu. It&#39;s good to do this as some &#39;phones have no method of going back through the history without this tag.

    Code:
    </p>
    <do type="accept" label="Back">
    <prev/>
    </do>
    </card></wml>
    Thats it for now, i hope you learnt something, i know i learnt alot just by typing and reading this lol.

    #2
    /tease.gif" style="vertical-align:middle" emoid="" border="0" alt="tease.gif" />t;line-height:100%">Wirelessly posted (Nokia3200/1.0 (4.1 Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Link/1.1)

    http://hadiy.mcommunity.biz

    Comment


      #3
      There isnt a big difference between the coding of php and wml, THANX

      Comment


        #4
        However you cannot have other tags inside links, for example the following will generate an error:

        Code:
        [url="index2.wml"]<big>[b]This will fail![/b]</big>[/url]
        [/b]
        Thats right, but you can do this:
        Code:
        <big>[b][url="index2.wml"]This will pass![/url][/b]</big>

        Comment


          #5
          Thats right, but you can do this:
          Code:
          <big>[b][url="index2.wml"]This will pass![/url][/b]</big>
          [/b]
          and it will be shown as
          This will pass! just bigger

          Comment


            #6
            u guys know where i can download a tutorial software for wml?

            Comment


              #7
              u guys know where i can download a tutorial software for wml?[/b]
              Why do you need a software? I learned by checking out the source code from other peoples sites. If you use opera to view wap pages, just right click and click &#39;source&#39;.

              I also found this to be a really helpful site: http://www.developer.com just search for &#39;learning wml&#39;

              Comment


                #8
                pm me...

                Comment


                  #9
                  just joking but i would need one in php

                  Comment


                    #10
                    Me too require one.

                    Comment


                      #11
                      THAT WOULD BE GREAT HELP THANKS !!!

                      Comment

                      Working...
                      X