WML Coding For Newbies!

Started on the old forum in August 2005 · view the original in the archive · old links redirect here

10 replies · 5,992 views · started 21 years ago · 6 min read

TL;DR · summary of 10 replies
  • - The thread did not resolve any specific coding issue or provide a solution for a problem.
  • - The thread discussed the basics of creating a simple WML document, including DOCTYPE declaration and basic structure.
  • - There was no mention of PHP integration or server setup in the provided context.
  • - Users asked about tutorials or software to learn WML, but these were not resolved within the given thread.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

Guest #1

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.

<?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 External image (may be gone) ...........................

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 ... you'll need to use paragraph alignment to center text. To stop centering you'll need to close the paragraph and open a new one, as in the followinf example:

<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'll show a line's worth of text, and when you move down so that the line has "focus" then it'll do a strange jump to the next line's worth of text, and then the next line'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 External image (may be gone)

  • bold *** Italic
  • underline *** emphasised
  • strongly emphasised
  • 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.
<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't supported at least there's the boldness to fall back on, and if for some reason this doesn't work it should be centered. ............

Now for the next code we going to add some pics to your page External image (may be gone) IMAGES *<img />attributes: *src= filename *alt= alternative text incase image can'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'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'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...

<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't be complete without HYPERLINKING, and you'll be glad to know that a WML link is the same as a simple HTML link - example:

[url="destination.file"]Some Text[/url]

It's even possible to have images in links, as in this example:

[url="index2.wml"][img]banner.wbmp[/img][/url]

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

[url="index2.wml"]<big>[b]This will fail![/b]</big>[/url]

Now for an auto redirect ontimer in your page External image (may be gone)

<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's one other navigation link that you might want to add to your card, which goes just outside the closing right near the end - you can add a back button to either one of the phone's keys, and/or the navigation menu. It's good to do this as some 'phones have no method of going back through the history without this tag.

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

hadiy #2

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

http://hadiy.mcommunity.biz

Hotblade #3

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

CLINT #4

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

<big>This will fail!</big>

Thats right, but you can do this:

<big>[b][url="index2.wml"]This will pass![/url][/b]</big>
lamar-wap #6

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

CLINT #7

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

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 'source'.

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

lamar-wap #9

just joking but i would need one in php

abhisar #10

Me too require one.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close