Library tutorials & articles
Wireless Markup Language (WML) Tutorial
Working with Cards
Each page on the device is called a card, and should contain an id, and a title attribute. A WML document may consist of a single card, or multiple cards.
| Attribute | Description |
|---|---|
|
|
The name of the card. This attribute acts as an anchor for navigating to the card. The name of the following card is "start". <card id="start" title="Juicy Studio">
The card may be linked to from the same deck with: <go href="#start"/>
If the card is in a different deck, the card may be linked to with: <go href="deckname.wml#start"/>
If the card is the first card in the other deck, the card name may be omitted. <go href="deckname.wml"/>
|
|
|
Determines whether or not a new context is initialised. If a new context is set, all variables are reset and the history stack is cleared. The possible values for this attribute are true or false. <card id="start" title="Juicy Studio" newcontext="true">
|
|
|
Allows you to specify a URI to open if the card has been navigated to through a prev task. <card id="start" title="Juicy Studio" onenterbackward="#main">
|
|
|
Allows you to specify a URI to open if the card has been navigated to through a go task.
|
|
|
Specifies the URI to open if the timer expires. <card id="start" title="Juicy Studio" ontimer="#nextcard">
See Working with Timers for more information on this attribute. |
|
|
The title used for the card. Some devices display the title on the screen if there is enough space.
|
Linking Cards
The id attribute is used to identify the name of the card to link to. There are three ways of specifying a link to another card. An absolute link contains the full path to the page, and is typically used to link to other WAP sites. A relative link contains the name of the WML file, either in the same directory, or with the relative path from the current directory. For WML documents that contain more than one card, you can provide an in-document link, which uses the card id to locate the card. The first set of examples use the a element to produce the link. The anchor element is introduced at the end of this page.
Absolute Link
<a href="http://www.juicystudio.com/index.wml">Visit Juicy Studio</a>
Relative Link
<a href="recent.wml">Recent Posts</a>
In-Document Link
<a href="#announce">Announcements</a>
Relative Link to a Particular Card
<a href="recent.wml#today">Recent Posts</a>
The following example is a WML document that contains three cards with in-document links to navigate between the cards.
links.wml
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Index Page">
<p>
<a href="#first">First Link</a><br/>
<a href="#second">Second Link</a><br/>
<a href="#third">Third Link</a>
</p>
</card>
<card id="first" title="First Card">
<p>
This is the first card.<br/>
<a href="#index">Back to Index</a>
</p>
</card>
<card id="second" title="Second Card">
<p>
This is the second card.<br/>
<a href="#index">Back to Index</a>
</p>
</card>
<card id="third" title="Third Card">
<p>
This is the third card.<br/>
<a href="#index">Back to Index</a>
</p>
</card>
</wml>
Output From Program
The following shows the original page, following the link to the first card.
The anchor Element
The anchor element extends the a element to perform a go, prev, or refresh refresh task. We'll use the refresh element later when we start to use variables in WMLScript. The go element is used to specify the URI, and the prev element is used to return to the previous page. The prev element is particularly useful, as it if there were several ways to end up at the page, they're always taken back to the page they come from. The following example is the previous example re-written to use anchor element.
anchor.wml
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Index Page">
<p>
<anchor>First Link<go href="#first"/></anchor><br/>
<anchor>Second Link<go href="#second"/></anchor><br/>
<anchor>Third Link<go href="#third"/></anchor>
</p>
</card>
<card id="first" title="First Card">
<p>
This is the first card.<br/>
<anchor>Back to Index<prev/></anchor>
</p>
</card>
<card id="second" title="Second Card">
<p>
This is the second card.<br/>
<anchor>Back to Index<prev/></anchor>
</p>
</card>
<card id="third" title="Third Card">
<p>
This is the third card.<br/>
<anchor>Back to Index<prev/></anchor>
</p>
</card>
</wml>
The output of running the above program is exactly the same as the previous program.
Related articles
Related discussion
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
ideas in building a captive portal
by sjranjan (2 replies)
-
A particular gallery image
by margy80 (0 replies)
-
(Very urgent)how to assign the value of the variable in javascript function into php variable
by mazhar_qayyum (3 replies)
-
Iterating through DB rows by column name
by fil.moore (0 replies)
Related podcasts
-
EarthClassMail.com - Moving from LAMP to .NET 3.5
Scott chats with Matt Davis, architect at EarthClassMail.com, about their move from a LAMP stack (Linux/Apache/mysql/PHP) to .NET 3.5. What's working, what's not, and what kinds of issues are they running into as their architect their solution.
Events coming up
-
Dec
3
The Auckland PHP December meetup
Auckland, New Zealand
Topic: Magento E-Commerce platform Speaker: Robert Popovic, LERO9, Robert is the Technical Director and co-founder of LERO9. Robert attended the Electrotechnical Faculty at The University of Belgrade where he graduated with a Masters in Computer Science and Information Technology. Robert has worked exclusively in the field of web and software development throughout his career.
hi
I am Jagannath working as Sr.Programmer in Med Write India Ltd. I have one doubt that how to search the latest modified file on the stipulated time and date.If you will help me then i will be happy
Bye
Jagannath
my alternate email address is b_jagan03@yahoo.co.in
Phno : 09849654314
Nice articlae but require more info on this
This thread is for discussions of Wireless Markup Language (WML) Tutorial.