WML » Tags » template

Syntax:
<template> ... </template>

The template tag creates a code template that is automatically added to every card in a single deck.

Only one template element can occur per deck. This tag can only be contained in a wml element. It can only contain do and onevent elements.
 
The individual card elements can override the behavior specified by the template element. The behavior specified in a template element by a do element can be overridden in a card element by another do element, but only if both do elements have the same name for the name attribute. Likewise, the behavior specified in a template element by an onevent element can be overridden in a card element by using the onenterbackward, onenterforward, andontimer attributes.
 
Nested Tags: do  onevent

Examples

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

<template>
   <do type="prev" label="back">
      <prev />
   </do>
</template>

<card id="card1" title="Card 1">
<p>
   <a href="#card2">
Go to Card 2</a>
</p>
</card>

<card id="card2" title="Card 2">
<p>
<do type="prev">
   <noop />
</do>
DevGuru is great!</p>
</card>

</wml>
Explanation:

This example uses the do tag to add a "back" hyperlink to each card. However, the use of the noop tag prevents the display of this back link in card2.

Language(s): WML
Code:
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<template>
   <onevent type="onenterbackward">
      <go href="#card3" />
   </onevent>
</template>

<card id="card1" title="Card 1">
<p>
   <a href="#card2">
Go to Card 2</a>
</p>
</card>

<card id="card2" title="Card 2">
<p>
DevGuru</p>
</card>

<card id="card3" title="Card 3">
<p>
is great!</p>
</card>

</wml>
Explanation:

This example uses the onevent tag to always navigate to card3 when a onenterbackward event occurs.

Language(s): WML

See Also: