Computer Science Canada WAP and WML |
Author: | rdrake [ Tue Nov 15, 2005 4:22 pm ] | ||||||||||||||||||||
Post subject: | WAP and WML | ||||||||||||||||||||
We all know that your can browse the internet on your phone, but how do we create those pages? We use an XML-based variant of HTML, called WML (wireless markup language). Of course we want some of our pages to be dynamic, which I will cover in another tutorial with PHP, but for now I will concentrate on static pages. Basic knowledge of HTML will help you understand the following better, but you should be able to follow along without. Preface There are some terms, abbreviations, and bits of information you should know before I begin. WML is the language used to create pages on your cell phone. Like HTML, there is a client-side scripting language called WMLScript. WMLScript is very basic but does enough for the type of pages you will be creating, but it is not covered in this tutorial. WAP (wireless application protocol) is what we use for accessing information over the internet. It is handled by the phone, so we do not really need to worry about it. WML is based on XML, so every tag must be closed. This is like XHTML, only it is more strict. Phones generally do not render pages which contain tags which are not properly closed. Basic Structure of a Page Every page must contain certain elements. Each page is composed of a stack of cards. These cards can call each other and allows more information to be in the pages without requiring the user to download more information, which costs money.
Text There are many ways to format text in WML. With no formatting, text must be encased in the p tag, much like HTML. Similarly, you can format text the same way as you can in HTML, with tags such as em and strong.
Links You can link almost the same way as in HTML, with the a tag. However, there is an alternative called the go tag.
Let's say you want to link to another card. It's very easy to do, just look at the following example.
Input Boxes There is no need to specify a form area here, it is assumed that your pages will be small enough and only contain one form per card. Forms are again similar to those of HTML, but again follow a more XML style syntax.
Variables Variables are either set automatically by input boxes, or by using the setvar tag. The above boxes would create two variables automatically, those being $(name) and $(age), the value of their name in the tag.
Images Considering the fact that WAP applications have very little bandwidth to play with, we must remember to use images sparingly. WML pages use a special type of restricted and small image type called wbmp. With photoshop you can save in that format, as with ImageMagick and probably others too. Images must be in this format in order to display properly.
Timers Timers allow us to do something with our pages after a certain amount of time has passed. They're useful if you want to display something like a splash screen. Let's take the following example, which should display an image then a message after 5 seconds (Note: the value of the timer is in 1/10 of a second).
Testing Your Code Without a Cell Phone Don't have a cell phone or just don't want to pay the fee for using the browser? Luckally there's a few emulators out there which allow you to avoid needing one. The one I recommend is YourWAP. It's a regular program which you install to your computer and it allows you to view online pages. You must have the pages saved on the web for you to access them. If you don't have a Windows box, then the TagTag should work well. I find the first one to be more accurate, but unfortunately it's Windows only. Timers tend to give me problems with this one. Here's an example of all this together.
I think that's about all I need to cover, if you have any questions, just ask and I'll try my best to answer them. |
Author: | Hikaru79 [ Tue Nov 15, 2005 5:53 pm ] |
Post subject: | |
Awesome! That's certainly an original topic, I haven't seen anything here about it ![]() +50 BITS |
Author: | rdrake [ Tue Nov 15, 2005 6:31 pm ] |
Post subject: | |
Hikaru79 wrote: Awesome! That's certainly an original topic, I haven't seen anything here about it Thanks. I could write another about using WML and other dynamic languages, such as PHP and Ruby if you'd like.![]() +50 BITS |