WML Objects and Syntax
WML Objects and Syntax
WML has more capabilities, commands, and
features that are presented in this chapter. Appendix I lists all the commands of
WML as well as each command’s attributes.
Templates
The <template>...</template> command is used to
place the same code in all of the cards in a deck. The code that is within the
<template> tags will be executed on every card in the deck. If you want to
override the template commands on one of the cards, you can put the same command
(e.g. do or onevent) and use the same name attribute for that command, and then
the commands in the card will be executed, not the commands in the template.
This is where the <noop/> command is often used. If you have a command in
the template that you do not want executed on one of the cards, by putting the
command with the same name on the card and then using <noop/>, the
<noop/> will override the template command. The <template> command
and its contents are physically put within the <wml> tags but not in any
specific card.
The onenterforward, onenterbackward, and ontimer attributes of the
<template> command are used in the same fashion as these attributes when
on the <card> command. When entering a card going forward (onenterfor- ward) or backward (onenterbackward)
control is transferred to the specified URL, or address or card number. On timer specifies what address or URL to go to when the timer
times out. When used with a template command, these transfers will occur on all
cards in the deck unless they are specifically overridden on certain cards.
Example 4.1 shows
the use of the template command to put a “Previous” button on all cards, that
executes the <prev/> command when pushed. However, on card1 a <do>
command was inserted with a <noop/> command so that the first card would
not have a “Previous” button. Also in this example, a <do> command with a
“Forward” button was put on cards 1 and 2. Figure 4.1 shows the screens of the three cards as they
occur from example 4.1.
482 times read
|
|
|
|