Lesson 4: Adding text and other content to WML pages
Our first working WML file is the standard 'Hello World!' example.
|
1.
|
<?xml version="1.0"?>
|
|
2.
|
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
|
|
3.
|
<wml>
|
|
4.
|
<card id="card1" title="Welcome">
|
|
5.
|
<p align="center" mode="wrap">
|
|
6.
|
Hello World From Softsteel Solutions.
|
|
7.
|
</p>
|
|
8.
|
</card>
|
|
9.
|
</wml>
|
|
|
The following pictures demonstrate how this script is displayed in the phone.com emulator and the Nokia blueprint WAP 1.2 phone emulator

phone.com
| 
Nokia
|
The new element in the script above is the tag-pair <p> </p>. These tags hold the details of a paragraph, and it should be noted that any text that you want to show on the screen must be wrapped in paragraph tags.
Paragraph alignment is handled by giving a value to the 'align' attribute in the initial <p> tag. The following comprise the accepted values:
align="left" [default]
align="right"
align="center"
The paragraph element also has a mode attribute, which specifies how the paragraph text is to be displayed on the screen. There are two possible values for the attribute:
mode="wrap" [default]
mode="nowrap"
When mode is set to nowrap, the paragraph text is forced to display on one line. On some phones horizontal scrolling is possible; others use a blinking system moving along the information. The pictures below demonstrate the effect on our emulators of setting the mode to nowrap in our card:

phone.com
| 
Nokia
|
|