Tips for Creating your First WML Page

WML (Wireless Markup Language) is the new web language for making sites on mobile phones. WML is used to create pages that can be displayed in a WAP browser. WML is a content format for devices that implement the WAP specification and preceded the use of other markup languages now used with WAP, such as XHTML and even standard HTML. Pages in WML are called DECKS. Decks are constructed as a set of CARDS.

The first thing you should enter on your WML document is:

Code:

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

<wml>

The above code determines the type of WML document and browser uses this line to identify the version of WML used by the WAP page. The <WML> tag is just like <HTML> tag.

Cards:

Instead of having pages, WAP sites have cards. These are what is displayed on the screen at one time, just like a page. More than one card can be inserted in each WML document (page). The mobile server automatically links all cards on a WML page. To declare a card, insert the following:

Code:

<card id="card ID" title="Card Title">

CARD BODY ( This is just like the BODY part of the HTML page. )

</card>

You can make several cards on a page. One card will display at one time on the mobile screen. You can link cards.When a WML page is accessed from a mobile phone, all the cards in the page are downloaded from the WAP server. Navigation between the cards is done by the phone computer – inside the phone – without any extra access trips to the server.

Putting Text on Cards:

You can put text on the card (wap pages) with the help of <p></p> tags. This tag works like the HTML paragraph tag. You can align the text with align attribute. Also, you can use the <br/> tag for line breaks. You can use different paragraph on each card. An example which shows the usage of p tag is given as follows:

Code:
<p align="center">Hello World!<br/>
Enjoy this wap Tutorial.
</p>

Linking Cards or WAP Pages:

You can link the WAP pages or cards just like HTML pages. With anchor tag, you can link the pages. Cards on same pages can be linked with the following format:

Code:
<a href="#Card ID">Text</a>

Another WAP pages or Card on another page can be linked with the following code:

Code:
<a href="another_page.wml">Text</a>
<a href="another_page.wml#Card ID">Text</a>

A page on another domain is linked as:

Code:
<a href="http://webmasters-forums.com">Text</a>

Putting Images on WAP Page:

You can insert images same as on HTML page. The <img> tag helps to insert the image on wap page. Let me allow to give a simple example that inserts a simple image on wap page:

Code:
<img src="example.wbmp" alt="Text" />

Don’t forget to put “/” at the end of single tags.

You can also use other tags using on HTML pages like table, strong, b, input, head, etc… The use of all tags is same like the use of them on HTML files.

WML Scripting:

Unlike HTML page, WML pages are little more dynamic in nature. This is because of its scripting facility. WMLScript is used to validate user input, generate dialog boxes, view error messages, access facilities of the user agent, and much more. To read more about WML Script, Click Here.

Putting WAP Files on Your Host

Upload all WAP files you created to your hosting server with the help of a good FTP software. There are several FTP available for free. Then name the home page as index.wml. Also name the card id, that you like to display on the mobile screen when you enters into the site, as index. Now you successfully created the home page. You can link to the other pages of your WAP site with the links provided on your pages.