How To Build WAP-Ready Website.pdf

(80 KB) Pobierz
PCPlus.166.HandsOn.WAP
hands on
WAP-ready Web site
The latest Internet buzzword is WAP. Simon Bisson embarks on a new
series showing you how to get your Web pages on to people’s mobiles
ith millions of mobile phones already
in use, it’s no wonder that over £22
billion pounds was raised by the recent auction
of third generation mobile phone licences.
Promising 2Mbps connections, the next
generation of mobile phones is going to change
the way we see the Internet.
You don’t need to wait that long to see the
mobile Internet, as the first few WAP (Wireless
Applications Protocol) phones have started to
appear – phones that will at least enable you to
use some Web services wherever you are...
Creating WAP pages
So how can you create your own pages for WAP
phones? WAP is an important step on the route
to an always-accessible Internet applications
framework, enabling mobile phones to access
simple text and form-based Web applications.
Working with WAP pages is similar to working
with traditional Web architectures. A WAP
Gateway acts as an interface between the TCP/IP
world and the mobile phone, translating
information and passing it to and from the
phone. One thing to remember with WAP is that
you don’t use HTML, which is designed for use
on large screens. Instead, WAP uses a mark up
language of its own: the Wireless Mark-up
Language (WML). You’ll find all the details of
WAP 1.2, the current version of the WAP
standard, on the WAP Forum’s excellent Web site:
www.wapforum.org .
If you’re used to working with HTML, you’ll
find some aspects of WML familiar, while others
The Nokia WAP Toolkit is one of the most popular
WAP development environments. You can use it to
edit and test your WML code. It’ll even simulate a
WAP Gateway to make your applications run correctly.
It’s a good idea to use as many different WAP
development toolkits as possible – as every phone
behaves differently. Here we’re using our test file in a
simulated Motorola P7389.
are very different indeed. WML is defined as an
XML DTD (Document Type Definition), so it
requires more care in implementation than a
piece of HTML code. You will need to be sure that
the tags you’re using are correctly terminated
otherwise a WML browser will fail to parse and
display your page.
You’ll find micro-browsers generally limited –
and thanks to their integration with the standard
mobile phone handset, also difficult to design
for. What works in a Nokia phone can’t be
guaranteed to work in a Motorola or Ericsson.
A deck of cards
To make things easier, every WML page is divided
into ‘cards’, each of which is displayed as a
separate entity by the WML browser. This deck of
cards approach requires you to explicitly add
navigation instructions to your cards, so that
users will be able to access the information you’re
delivering to their phones. You can use <a href>
style links, which aren’t understood by every
phone, or by using WML’s <do> and <go> tags,
which work with a phone’s built-in menu system.
WAP browsers
The WML browsers in WAP phones are known as
‘micro browsers’, and you’ll need to be careful
how you design content that will be delivered by
WAP. The first generation of WAP phones, like
the Nokia 7110 or the Motorola P7389, have
displays can only show 3 or 4 lines of text at a
time. You must take this account when you’re
designing WML pages.
THE NEXT GENERATION
iMode – Japan shows the way to the future
In Japan the mobile Internet is using HTML and colour displays...
hile the western world has standardised
WAP and WML as the key technologies for
mobile Internet services, they are limited by the
low speeds of the current GSM data network. In
these days of ADSL and cable modems, 9,600 bits
per second is somewhat slow...
Over the next few months the main GSM
network operators in the UK will be rolling out the
General Packet Radio Service (GPRS) services.
The GPRS is a different way of delivering mobile
data, as it is equivalent to an always-on ISDN
connection. The next generation of the WAP
standard, WAP 1.2, is likely to add new services
designed to support these higher bandwidth
connections. But what type of applications will
we see?
One pointer could be NTT DoCoMo’s wireless
Internet service iMode. This is a 22Kbps packet
radio service running in Japan’s main cities. Its low
prices have attracted a lot of subscribers, and it
uses a compact version of HTML to deliver
applications to phones.
C-HTML is easy to use and it’s very easy to
convert existing Web sites to run in iMode phones.
With most of the main Japanese consumer
electronics companies producing iMode phones,
they’re becoming cheaper and more sophisticated
– with the latest offering colour displays. Games
and chat are the most popular services on iMode,
with some phones downloading new Tamagotchi
or Pokémon-style characters for a small fee. You
can also shop on-line, or access your bank details.
Next year will see the British Isles’ first 3G
trials in the Isle of Man. BT Cellnet has partnered
with NTT DoCoMo to see how the iMode
experience can be brought to the next generation
of mobile phones.
You can find out more about iMode at
www.nttdocomo.com/.
164
PC Plus August 2000
How to build a
W
W
140207301.002.png 140207301.003.png
web workshop
Every card has an ID and a name. The ID is
used to handle navigation between the cards in
the deck. The simple deck shown below has a
single card, which will display a line of text in a
phone’s screen.
<option value=”Goodbye”> Goodbye
</option>
</select>
CODE CORNER
Your first WAP
page
WML won’t be too unfamiliar to
anyone used to HTML. Just
remember, it’s a lot stricter
<?xml version=”1.0”?>
<!DOCTYPE wml PUBLIC “
//WAPFORUM//DTD WML 1.1//EN”
“http://www.wapforum.org/DTD/wml_
.1.xml”>
<wml>
<card
id=”card1”title=”PCplus”>
<do
type=”accept”label=”Next”>
<go href=”#card2”/>
</do>
<p>
This is a test WML deck
for PC Plus.
</p>
</card>
<card id=”card2” title=”Pick
List”>
<do
type=”accept”label=”Next”>
<go href=”#card3”/>
</do>
<p>
Please choose a word:
<br/>
<select name=”word”
value=”Hello”title=”Word”>
<option
value=”Hello”> Hello</option>
<option
value=”Goodbye”> Goodbye</option>
</select>
</p>
</card>
<card id=”card3”
title=”Name”>
<do type=”accept”
label=”Next”>
<go href=”#card4”/>
</do>
<p>
Please enter your name:
<br/>
<input type=”text”
format=”*M” name=”NAME”
title=”Name:”/>
</p>
</card>
<card id=”card4”
title=”Display”>
<p>
$word
$NAME
One difference from HTML is that you can
access the resulting value and display it in the
rest of the cards of a deck, before submitting back
to a Web server for processing just like a standard
form. The ‘name’ of a select block is used to hold
the resulting value, and it can be displayed by
prefixing it with a $. In our example, card 4
displays both the values of the select block and
the input statement.
Select blocks are the best way of creating
interactive WML applications. You can use them
to provide a WAP site’s users with pre-configured
choices, rather than expecting them to use the
phone to type in values.
One of the difficulties with a phone’s simple
keyboard is that is can take up to 4 key presses
just to enter a letter. If a free form input is
needed, you can use the input tag to control a
user’s inputs using an input mask. This can limit
the types of characters they are allowed to input,
or can force a specific length. You’ll find this also
useful if you’re using the input tag to input a
password – which if you choose the passport
type, will be concealed rather than displayed. It’s
also possible to group the various types of input
element, enabling you to create complex
applications that behave more like HTML forms.
<wml>
<card id=”card1” title=”PCplus”>
<p>
Hello from the PC Plus Web
Workshop.
</p>
</card>
</wml>
Using the following snippet of code, you can
use a phone’s keys to move from one card in a
deck to another. A label displayed on the phone
menu as ‘Next’ will enable a user to move from
one card to another in a deck.
<do type=”accept” label=”Next”>
<go href=”#card2”/>
</do>
One thing to notice about WML is that the
<go> statement in this block has to be explicitly
terminated by a trailing slash – otherwise it will
cause an error, and won’t be displayed. You also
have to make sure that you only use lower case
for your WML tags, otherwise they won’t be
recognised by XML parsers. It’s also good form to
only use lower-case for your HTML tags, as the
next release of HTML will be XHTML 1.0, which
applies XML rules to HTML.
See the Code corner for a more complex piece
of WML code. It is a four-card deck that takes
user input and then displays it on the phone’s
screen. It might seem fairly simple by normal
HTML standards, but it gives you a good idea of
most of the main WML functions.
All the text blocks are surrounded by <p>...</p>
tags and the document has an XML document
type, so that it can be validated against the official
WML specification. You’ll need to include this
block at the start of every WML document you
create for it to be handled by most WAP gateways:
Get a toolkit
If you want to know more about WML,
download the Nokia WAP Toolkit from
www.nokia.com . Not only does it come with
plenty of documentation on WML in PDF
format, it also includes a set of simulators that
enable you to test your pages. These include the
popular 7110, as well as two of their latest
phones: the 6110 and 6150.
Nokia isn’t the only company with WAP
phones and simulators. Motorola has one, as
does Ericsson. Most of these companies will ask
you to sign up to their free developers
programmes, which are well worth using. They
provide support and plenty of information you
won’t find elsewhere – there were only two books
on WAP available at Amazon when this article
was written...
Of course, if you want to have something
more generic, you can use the tools provided by
the originators of the WAP standard: Phone.com .
You’ll also find that soon most of the commonly
available Web design tools will support WML.
Already HomeSite will handle WML documents,
and Macromedia are working with Nokia to add
support to Dreamweaver.
<?xml version=”1.0”?>
<!DOCTYPE wml PUBLIC “
//WAPFORUM//DTD WML 1.1//EN”
“http://www.wapforum.org/DTD/wml_1
1.xml”>
The DOCTYPE section includes the URL of the
official WML XML definition document.
Our example uses two cards to take inputs.
These use the two most common WML input
statements, the <select> block and an <input>
statement. The <select> block is just the same as a
standard HTML form select statement, and
behaves much the same way. You’ll need to give
it a title, as it’s usually displayed in its own screen
by most WAP browsers.
</p>
</card>
</wml>
Upload your pages
Once you’ve created (and tested) your first WML
pages, upload them to your Web space – making
sure you use the WML extension for all your
pages. You’ll also need to check that your ISP has
configured its Web servers to use the correct
MIME-type for WML decks (text/vnd.wap.wml),
so they’re handled correctly by the WAP gateways.
Then all you need is a WAP phone to see if you
can access your Web pages on the move... PCP
Simon Bisson
simon.bisson@pcpmag.co.uk
NEXT MONTH
<select name=”word” value=”Hello”
title=”Word”>
<option value=”Hello”> Hello
</option>
How to create more complex WML decks, using
WAP’s built-in scripting language WMLScript.
August 2000
PC Plus
165
140207301.004.png 140207301.005.png 140207301.001.png
Zgłoś jeśli naruszono regulamin