Logo         Community
  Trog
Services
The Company
Community
Columns
Your Account
Contact Us
 
 
Demystifying WML (part 2)
An introduction to the WML programming language.

| Turning The Tables |

Back in the good old days of HTML 2.0, when Microsoft and Netscape hadn't yet introduced <DIV>s and <LAYER>s, most Web designers relied almost entirely on tables to align and place images, text and other objects on their Web pages. And so, given that WML pages are usually displayed on tiny screens, it's essential that there be some mechanism in place to help WML developers maximize every centimeter of screen real estate.

Enter the <table> tag - albeit in slightly modified form. Take a look at this example, which demonstrates how tables can be used to format WML content.

<?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="intro" title="Welcome">
<p align="center">
Welcome to IceScream.com!<br/>
--------------------<br/>
Your search for the perfect ice-cream ends here...<br/>
--------------------<br/>
<a href="#scream1" title="Violent Vanilla">Violent Vanilla</a><br/>
<a href="#scream2" title="Crazy Chocolate">Crazy Chocolate</a><br/>
<a href="#scream3" title="Homicidal Honey">Homicidal Honey</a><br/>
</p>
</card>

<card id="scream1" title="Violent Vanilla">

<p align="center">
Violent Vanilla<br/>
--------------------<br/>
<table title="menu1" columns="2">
<tr>
<td>
Scoop
</td>
<td>
4 bucks
</td>
</tr>

<tr>
<td>
Cone
</td>
<td>
3 bucks
</td>
</tr>

</table>
</p>

<p align="left">
<a href="#intro" title="back">back</a>
</p>

</card>

<card id="scream2" title="Crazy Chocolate">

<p align="center">
Crazy Chocolate<br/>
--------------------<br/>
<table title="menu2" columns="2">
<tr>
<td>
Scoop
</td>
<td>
2 bucks
</td>
</tr>

<tr>
<td>
Cone
</td>
<td>
3 bucks
</td>
</tr>

</table>
</p>

<p align="left">
<a href="#intro" title="back">back</a>
</p>

</card>

<card id="scream3" title="Homicidal Honey">

<p align="center">
Homicidal Honey<br/>
--------------------<br/>
<table title="menu3" columns="2">
<tr>
<td>
Scoop
</td>
<td>
6 bucks
</td>
</tr>

<tr>
<td>
Cone
</td>
<td>
8 bucks
</td>
</tr>
</table>
</p>

<p align="left">
<a href="#intro" title="back">back</a>
</p>

</card>

</wml>


Output image
Output image

Like in HTML, a WML table begins and ends with the <table>...</table> tags; each row is represented by a <tr>...<tr> pair, with each cell further represented by pairs of <td> tags. Unlike in HTML, though, <tr> and <td> tags don't take any attributes in WML - the only attribute you can control is the alignment of a cell, and that information has to be specified in the <table> tag itself with the "align" attribute.

Note, however, that the "align" attribute failed to work in any of the simulators we tried - so you might want to watch out for errors if you decide to use it.

Additionally, unlike HTML [where pretty much anything goes], tables in WML are quite rigid - you need to specify the number of columns in the <table> tag with the "columns" attribute. If the actual number of columns ends up being greater or less than the number specified, cells will end up getting concatenated or inflated by the display device - something that's sure to displease both the author and the user.

Finally, <table> tags cannot be nested within each other in WML.


How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!


previous page more like this  print this article  next page
 
Search...
 
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
more...
 
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
more...
 
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
more...
 
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
more...
 
In cut!...
American Chai
The Core
Possession
more...
 
Find out how you can use this article on your own Web site!


Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback