Server colocation, web database interface design (mySQL/PHP), web site design

ammonet offers WAP enabled web hosting and expertise in WAP, WMST development.

 
 
Introduction Phones FAQs Glossary

WAP Frequently Asked Questions

What is WML?

WML stands for Wireless Markup Language and is just one part of the WAP specifications - analogous to the HTML language used to build Internet web pages. It is a markup language based on XML and is used to specify the format and presentation of text, hierarchies of screens (known as a 'deck'), and hyperlinks between those screens (or 'cards').

What is a WML card

A WML deck contains a collection of cards. The card element is a container of text and input elements that is sufficiently flexible to allow presentation and layout in a wide variety of devices, with a wide variety of display and input characteristics. A card can contain markup, input fields and elements indicating the structure of the card.

A wml page is basically to a mobile phone what an HTML page is to an internet browser - it contains the code that lets the browser know what you want displayed on the screen. If you are already proficient or even know just a little about HTML, then you will find making WAP pages simple! All you need to remember is that wml pages are quite a bit stricter than HTML pages - they have to have perfect coding for them to work.

Because mobile phones are not as powerful as computers, and certainly do not have as large screens, the code has to take on a special reduced form - a 'deck'. A deck is composed of a series of 'cards'. Because mobile phones have very little memory, you have to display all of your information as little chunks. These are cards. A group of these chunks (cards) is called a deck. A WAP enabled browser will deduce that the wml document is a deck, so all you have to do is tell it where the cards start and finish. Usually you have between one and three cards.

What is a WML deck of cards?

WML "pages" or WML documents are referred to as decks. Each deck consists of one or more cards. Each deck begins and ends with the <wml> tag, and each card begins and ends with the <card> tag. When the WML micro browser accesses a WML document (or deck), it reads the whole deck, and navigation between the cards in this deck is done without the need to load any more data. This is important to know, because once you've loaded a deck, all cards within it stay statically in the WML micro browser memory until the browser is instructed to reload the whole deck. The <card> tag of WML is very similar to the <a name> tag of HTML.
<wml> 

<card id="start_menu"> 
...some code... 
</card> 

<card id="purchase"> 
...some more code... 
</card> 

</wml>

Here is an example of a multi-carded deck, and how you can link between the two:
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" 
"http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 

<card id="card1" title="My Wap Page"> 
<p> 
Hello world - welcome to my first wap card! 
</p> 
<p> 
<a href="#card2">Go to the second card</a> 
</p> 
</card> 

<card id="card2" title="Second Card"> 
<p> 
Welcome to my second wap card! 
</p> 
<p> 
<a href="#card1">Go back to the first card</a> 
</p> 
</card> 

</wml> 
top of page 

WML is very much like XML. It is very strict compared to HTML , which means that when it is parsed and interpreted by the micro browser there is not much room for error. Just as in HTML, the language uses formatting tags bounded by < and >. Most tags have start tags <tag> and end tags </tag>. The items contained between the start and end tags are called elements. Some tags are so called empty-element, and have tags with no content <tag/>. Most elements may have attributes which further describe what is to be done with the content within it. Attribute names must be in lower case, and the attribute values must be enclosed in double quotes. Some elements require attributes, and some attributes are optional. 
The general format of tags with attributes is <tag attribute1="value">.
Variables may be present in the WML cards, and their general format is $(variablename). 
A WML deck has a specific format, and must begin with the following XML and document type declarations:
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM/DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
All elements in a deck must be placed within the <wml> and </wml> tags.
 

 Yes! And be careful, because WAP v1.1 uses lower-case tags.

How do I display a dollar sign in a WML page?

Use two dollar signs together in the WML code to display a single dollar on the rendered page.

How do I use non-Latin letters in WML pages?

Use the following in your document prologue:

encoding="ISO-8859-1"? or encoding="UTF-8"?

The ISO-8859-1 and UTF-8 encodings support such characters by using the characters &# followed by the relevant ASCII codes.

There are a variety of SDK's available. AnywhereYouGo.com has a WAP SDK and IDE list that is kept up to date. You can check out a variety of tools to use from that section. The Nokia and Ericsson SDK's are quite popular, and the SDK from YoSpace has been gaining quite a bit lately. For writing simple WML pages, any text-editing tool is suitable. Certain HTML authoring tools may also be useful (especially if they support user-definable tags), such as Allaire Homesite. You can use the SDK for simple testing, but for larger projects this might be difficult. AnywhereYouGo.com is building a set of web-based tools to help WAP testing efforts.

How can I convert HTML pages into WML?

When thinking about converting HTML pages, it's worth considering that WML is designed for small screens, and is therefore not as visually rich as HTML. Any conversion will compromise a great deal of the HTML content and formatting, as well as any in-line scripting. Some simple HTML pages may be converted satisfactorily. Conversion can either be once-off using a package such as Spyglass Prism, or on-the-fly by a WAP gateway filter.

Plug-ins for Adobe Photoshop 5.x and PaintShop Pro which support the WBMP format are now available from RCP Distributed Systems. Both GINGCO and Teraflops offer developer tools for converting various types of images into the WBMP format.

What is WMLScript?

WMLScript is a client side script language based on ECMA script. It is very much like JavaScript. WMLScript has been modified to fit the limitations of the WAP environment, and is in many ways limited compared to JavaScript.

Can I embed WMLScript into a WML deck?

No. Unlike the way in which you can embed JavaScript in HTML pages, WMLScript must be contained in a file separate from the WML that calls it.

For a primer and introduction to WMLScript, we recommend the  WMLScript.com site. It contains good WMLScript info and even a WML Script Library.

What is the maximum allowable size of a WML page on a mobile phone?

This is likely to vary from one phone to another. However, as a guideline, you should aim to keep compiled pages under 1,400 bytes.

How do I prevent a WML deck from being read from the cache?

After a WML deck has been downloaded to the WAP device, it lives in the WAP device's memory for a certain period of time. Until this period has expired, the deck will not be downloaded from the server but instead from the WAP device memory. This is known as caching, and it obviously speeds things up considerably. However, in some rare cases you might not want the deck to be read from the cache memory but from the server. A typical case is where you have a deck containing cards with information that gets updated frequently. By adding some cache information to the HTTP header you send out from the server, you can tell the WAP device that the following deck should never be stored in the cache. Note that this requires that you are able to produce HTTP headers on the server side, either using PHP, ASP, Perl or some other type of server side scripting language. The lines cannot be included in the deck code as they are HTTP header information, not WML elements.

IMPORTANT! For static decks, or if you do not have access to a server side script language, many browsers support META tags that control caching on the browser. See the end of this section for examples on using META tags for controlling the cache. See the W3C HTTP specifications for more details on HTTP.
With the following lines added to the HTTP header, the deck will expire immediately:
Expires: Mon, 26 Jul 1997 05:00:00 GMT 
Last-Modified: DD. month YYYY HH:MM:SS GMT 
Cache-Control: no-cache, must-revalidate 
Pragma: no-cache 
The first line tells the micro browser that the deck should expire some time in the past. The second line tells the browser when the deck was last
modified, and "DD" should be replaced by the current day-of-the-month (eg. "28"), "month" with the current month (eg. "january"), "YYYY" with
the current year (eg. "1999"), "HH:MM:SS" with the current time (eg. (08:19:23"). The third and the fourth line have the same effect, ie. to tell
the browser that the deck should not be cached - line three is HTTP 1.1 and line four is HTTP 1.0.
The following PHP example produces the above header each time the deck is accessed.
<? 
header("Content-type: text/vnd.wap.wml"); // set the correct MIME type 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // expires in the past 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Last modified, right now 
header("Cache-Control: no-cache, must-revalidate"); // Prevent caching, HTTP/1.1 
header("Pragma: no-cache"); // Prevent caching, HTTP/1.0 
?> 
Here's an example using WebClasses in VB, using "-1" as a value for Response.Expires to prevent caching.
Private Sub WebClass_Start() 
'Set correct MIME type 
Response.ContentType = "text/vnd.wap.wml" 

'Make sure no caching 
Response.Expires = -1 
Response.AddHeader "Pragma", "no-cache" 
Response.AddHeader "Cache-Control", "no-cache, must-revalidate" 

'Use basicwml(my own) as template 
Set NextItem = basicwml 
End Sub 
And here's an example in ASP, again using "-1" as a value for Response.Expires to prevent caching.
<% 
Response.ContentType = "text/vnd.wap.wml" 
Response.Expires = -1 
Response.AddHeader "Pragma", "no-cache" 
Response.AddHeader "Cache-Control", "no-cache, must-revalidate" 
%> 
And finally a couple of examples on controlling the caching of static decks using META tags:
The following deck will always be loaded off the server. Note that you should never use this unless you know what you're doing since it eats
bandwidth and "wastes" time, every time the deck is requested.
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 
<head> 
<meta forua="true" http-equiv="Cache-Control" content="max-age=0"/> 
</head> 
<card id="alwaysexpire"> 
<p>This deck will never be stored in the cache</p> 
</card> 
</wml> 
The following deck will be loaded instantly from the browser's cache memory instead of from the server until 86400 seconds (24 hours) have
passed.
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 
<head> 
<meta forua="true" http-equiv="Cache-Control" content="max-age=86400"/> 
</head> 
<card id="expire1day"> 
<p>This card will live in the cache for a day</p> 
</card> 
</wml> 
Some browsers such as the UP.Browser will not reload a deck if it is reached by going "back" from another card. (The object of the cache is to
save bandwidth and time). To force this behaviour, you must use the must-revalidate parameter to the META tag.
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>o

How do I get a WML card to refresh itself?

Those of you who have some experience from the web environment will most likely have used the <meta http-equiv="refresh" content="1;http://somewhere.com/"> tag to force a browser to load a new or the same page. Although some META tags are supported in the WAP environment, a much better way of doing the same thing in WML is to use the <ontimer> tag. The following piece of code will force the browser to load another deck after a certain time. For the example below, the deck will jump to another deck called nextdeck.wml.
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 
<card id="splashscreen" ontimer="nextcard.wml"> 
<timer value="40"/> 
<p>Please wait for the timer to run out...</p> 
</card> 
</wml> 
The following piece of code will force the browser to reload the same card after a certain time. For the example below, the deck file is called
loop.wml.
<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 
<card id="loop" ontimer="loop.wml"> 
<timer value="40"/> 
<p>This text will be shown over and over again...</p> 
</card> 
</wml> 

Can I use Active Server Pages (ASP) to produce WML pages?

Yes. You can create WML in exactly the same way that you create HTML. If you have written your ASP pages to produce WML, just remember to set the MIME type correctly at the start of the page:
Response.ContentType = "text/vnd.wap.wml"

Can I use CGI applications to produce WML pages?

Yes. You can create WML in exactly the same way that you create HTML. If you have written your application pages to produce WML, just remember to set the MIME type correctly at the start of the output. The form will vary depending on the language in which you have written your application.

Can I use Java Servlets to produce WML pages?

Yes. You can create WML in exactly the same way that you create HTML. If you have written your servlets to produce WML, just remember to set the MIME type correctly.

How can I create WML pages that have access to a database server?

As for creating HTML pages, any relevant server-side technology can be used for creating dynamically-created WML pages. Examples include Active Server Pages (on IIS servers), CGI, and Java Servlets. 

How do I use ColdFusion to produce WML pages?

To serve WML pages with ColdFusion, simply add

<CFCONTENT type="text/vnd.wap.wml"> 

To configure your server for WML, first FTP into your site and go into the /www/conf/ directory. You then edit your httpd.conf file (make sure you open the file in edit mode), adding 'index.wml' to the 'DIRECTORYINDEX' line. Finally, you edit your mime.types file (make sure you open the file in edit mode), adding these mime types to the bottom of the file: 

text/vnd.wap.wml .wml 
image/vnd.wap.wbmp .wbmp 
application/vnd.wap.wmlc .wmlc 
text/vnd.wap.wmlscript .wmls 
application/vnd.wap.wmlscriptc .wmlsc 


Contact 


   
Copyright © 1998-2012. ammonet. All rights reserved.