WML Bigromu

This will help you build Learn WML,Learn WAP applications...Learn WML,Learn Wireless,Understand Markup Language Tutorial, Wireless Application Protocol Tutorial, Building WAP sites tutorial, Building Wireless Application Protocol Website tutorial, Web Site tutorial, Wap Site tutorial, Wap tutorial, WAP tutorial, Site Mobile tutorial, Mobile Site Tutorial, PDA SITE,

Saturday, December 09, 2006

A simple HAWHAW code

Create a new file in the same directory where hawhaw.inc is located. Use an editor of your choice to write the following PHP script:

require("hawhaw.inc");
$myPage = new HAW_deck("FAQ Demo");
$myText = new HAW_text("Hello WAP!");
$myPage->add_text($myText);
$myPage->create_page();
?>

Store this file as test.php. (Alternatively you can save your file as test.wml if you have administered your webserver to activate PHP for .wml extensions.)

What is the meaning of these few instructions? Before you can use any HAWHAW function calls, you have to include the hawhaw.inc file. Afterwards you have to define one so-called HAW_deck object. The whole HAWHAW API follows a strict object-oriented approach. There are some objects like HAW_deck or HAW_text. And there are object functions, to perform actions on those objects. So what we do in line 3 of our tiny example is: We define $myPage as an object of the class HAW_deck. When you take a look at the HAWHAW reference, you will see that the constructor of HAW_deck optionally awaits some title for your 'deck'. Btw, a deck is an expression that is often used in the WAP terminology. In HAWHAW's context you don't have to distinguish between deck and page. It is the same.

When you examine the HAW_deck constructor in the reference in detail, you will notice, that there is another optional input parameter alignment. If you would have called

$myPage = new HAW_deck("FAQ Demo", HAW_ALIGN_CENTER);

the whole deck would have been displayed centered. Every time when there is a predefined value mentioned in the argument list of a function, this value is provided by default as long as you don't supply this parameter explicitely.

So, what we have now is an empty HAW_deck object. Let's bring some content into it: In line 4 a HAW_text object is defined. The reference entry for HAW_text tells you that you have to provide the text (you guessed that, right?) and (optionally) a text format. But to define this object does not automatically make it a part of your HAW_deck object! Therefore you have to call the HAW_deck object's object function add_text(), as done in line 5. Perhaps you ask now why this association is not done automatically, but you will understand it, when you want to re-use HAW_text or HAW_image objects in many positions of your HAW_deck object.

Okay, now we're almost through. We have defined our HAW_deck object and we have filled it with one HAW_text object. Now we only have to make the whole thing visible. Therefore we have to call the HAW_deck object function create_page(). So what we have learned is: For EACH page created by HAWHAW, we have to create ONE HAW_deck object, fill it we some content (like text in this example or images, links etc. as we will see in the succeeding paragraphs), and finally throw it out by calling create_page().

Now point your webbrowser to test.php: What you see is the most simple HAWHAW application ever possible.

VoiceXML

XHTML Mobile Profile (WAP 2.0) will be the standard for modern phones. If HAWHAW detects a XHTML-capable phone, dedicated XHTML output is created. From HAWHAW version 5.4 on there comes color to phone! HAWHAW application programmers are able to design colored applications which are viewed best on a XHTML device or PDA with color display, while these applications run well on each old monochrome WAP 1.1 device too.

XHTML ???

XHTML Mobile Profile (WAP 2.0) will be the standard for modern phones. If HAWHAW detects a XHTML-capable phone, dedicated XHTML output is created. From HAWHAW version 5.4 on there comes color to phone! HAWHAW application programmers are able to design colored applications which are viewed best on a XHTML device or PDA with color display, while these applications run well on each old monochrome WAP 1.1 device too.

MML ????

MML (Multimedia Markup Language) is a markup language used by japanese mobile devices from J-Phone Communications Co Ltd. If HAWHAW detects an MML device, cHTML-like MML output will be generated.

iMODE ???

i-ModeTM is the killer application in Japan and is on the jump to conquer other countries too. Whenever HAWHAW detects an i-Mode browser, cHTML output will be generated.

Visit DoCoMo

HDML????

HDML is a WML predecessor and still widely used in North America and Japan. Whenever the HTTP request header indicates that the client browser supports HDML 3.x only, appropriate HDML output will be generated by HAWHAW.

Why to use HAWHAW?

HAWHAW satands for HTML And WML Hybrid Adapted Webserver.

The current situation out there is that many WAP applications are highly incompatible and not able to interwork with different mobile devices. This is mainly caused by strong differing browser implementations and network configurations. Starting to program WML means to painfully learn about all those pitfalls one by one and day by day.

With HAWHAW, the programmer can rely on the accumulated experience of many running mobile applications. The compatibility of a direct WML-coded application is highly dependent from the programmer's personal knowledge. The mark-up output of a HAWHAW-based application contains the knowledge of many running HAWHAW applications out there. This does not mean, that the HAWHAW-created output is totally perfect under all situations. But it will automatically become better and better because each feedback from a single application can result in an improvement of the underlying hawhaw.inc library.

Existing HAWHAW sites will therefore benefit from future HAWHAW evolution steps. Without any additional development effort you can upgrade your running applications. Users of the HAWHAW PHP class library simply download a higher version of the HAWHAW class lib. HAWHAW XML users are upgraded automatically in the very moment, when the involved HAWHAW proxy upgrades to an higher version. This way your site or application is best prepared for future requirements.

HAWHAW was developed according to the Wireless Application Protocol Wireless Markup Language Specification Version 1.1 and according to the HDML Language Reference V3.0. It additionally supports the Openwave GUI extensions for WML 1.3. If HAWHAW's browser detection recognizes that the requesting device supports the proprietary Openwave WML extensions, special WML output will be submitted. There is no extra effort required to support GUI elements like select boxes, radio buttons or submit buttons. WAP devices which understand WML 1.1 only, will receive the standardized WML tags instead. So there's no need for the application programmer to deal with different code for various browsers.

Browser compatible WML

Creating your wapsite compatible with all kind of browsers is a big headaque. Various tyoes of browsers available on mibole devices are WAP, WAP2.0, iMode, HDML, XHTML, MML VoiceXML and lots of other species are available on PC.

Now, I will discuss how you can create your wap site browser independent.

I will discuss here a opensource class "HAWHAW".

HAWHAW is a toolkit that helps webmasters to make their website mobile, i.e. accessible by a wide range of mobile devices and standard browsers. There are three components the HAWHAW toolkit consists of:

* hawhaw.inc - The PHP class library
* HAWHAW XML - The markup language
* HAWXY - The HAWHAW proxy

Each of these components will be explained in detail here in this document.

Each HAWHAW users can choose the component which fits best for his personal requirement:

PHP programmers can use the PHP class lib, to set-up taylormade mobile standalone applications on their PHP enabled webserver.

Webmasters can use the HTML-like HAWHAW XML markup language, to provide wireless accessible content without any programming skills or special webserver support.

Service providers can set-up their own HAWHAW proxy, which can be used by the before-mentioned webmasters for the required markup conversion.

The whole HAWHAW code, both for the HAWHAW PHP class library and the HAWHAW proxy server is open-source and available for free under GPL. Users of the HAWHAW XML markup language don't need any code at all, because they just have to edit HAWHAW XML files, which are accessed via other people's proxies.

Monday, November 06, 2006

Browsers Browsers every where

Soon I will be writing on how to make your Wap Site compatible with CHTML, iMode and WAP browser ... So hang on.

Cheers
Saurabh Periwal

Friday, October 13, 2006

Sorry Forgot this ...

You can also ...

Via the Apache httpd.conf file.

You can modify the httpd.conf file only if you have control of the Apache server itself.

Locate the AddType section of the httpd.conf file and add the MIME types listed above. Then save the file and restart the server.

Review the Apache documentation for further information regarding the httpd.conf file.
Via the .htaccess file.

Just insert the MIME types into an .htaccess file and place it into the directory where your WML pages are kept.

Note: If after completing these steps you still cannot serve a WML page, contact your ISP for further information, as the server is sometimes configured to ignore .htaccess files for security reasons.

Mime Types

In order for Apache to correctly interpret the type of file (e.g. GIF, HTML, JPEG, PHP, etc...) being requested by a user, it must know its MIME type.

It is necessary for you to secure permission to modify Apache's httpd.conf file, so that Apache can correctly recognize the MIME type extensions involved with WML.

Otherwise, without permissions, you will need to place the MIME-types within a .htaccess file.

The MIME types that you will need in order to correctly serve WML documents are as follows:
# MIME Types for WAP

# For PHP 4.x, use this:
AddType application/x-httpd-php .wml

# For PHP 3.x, use this:
AddType application/x-httpd-php3 .wml

# For normal WML pages.
AddType text/vnd.wap.wml .wml

# For WML embedded graphics.
AddType image/vnd.wap.wbmp .wbmp

# End MIME Types for WAP

The above MIME types must be added to the Apache server's configuration file. There are two options for doing so:

* Via the Apache httpd.conf file
* Via the .htaccess file.

Prerequisites

It is highly recommended that you download any one of the several development toolkits available for testing a WML application. I recommend the following:

* Phone.com
Up.SDK 4.0; Available for the Windows and Solaris platforms.

* Nokia
The Nokia WAP Toolkit 2.0; Available for WinNT 4.0 with SPE and Win98. (Also requires JDK Runtime Environment 1.2.2 or higher.)

Wednesday, September 13, 2006

Inserting PHP into a WML document

Any WML document containing PHP must have the following lines of code (known as a prolog) placed at the very top of the deck:




<?php
// send wml headers
header("Content-type: text/vnd.wap.wml");
echo("<?xml version=\"1.0\"?>");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. "http://www.wapforum.org/DTD/wml_1.1.xml\">");
?>

This is necessary because PHP will, by default, send the line Content-type: text/html . By using PHP's header() function, however, it is possible to suppress this line, thereby sending the correct (wml) one, instead.

The WML Language: Two Key Characteristics

The WML Language: Two Key Characteristics

  • WML is known as a strictly defined language, meaning there is no room for syntax errors, including that of case (all WML elements must be specified in lowercase). As many of you know, one can get away with just about anything when coding in HTML, as the browsers are rather lenient when it comes to syntax errors. This is not the case with WML. Removing just one quotation mark or tag will result in a parse error within the browser.
  • The maximum size of a WML deck is currently only 1492 bytes. This is quite a step backwards from the occasional huge HTML document that we have grown accustomed to seeing. Therefore, discretion should be taken when defining and combining various cards to form decks so that this limit will not be surpassed.

Thursday, August 24, 2006

Background Information

Communication between a common web server and a WAP-enabled wireless device, in principle, is much the same as that between the web server and the traditional pc-based browser , but with one additional step.

This extra step involves the transfer of information by a WAP gateway. WAP gateways serve as intermediaries between the client-based wireless browser and an information server.

This process is illustrated below:


Consider a typical example of the communications process, as illustrated in the above example: Assume we have defined a deck of two cards. A wireless-device user requests the deck (document). The sequence of events that would take place as a result of this request would be as follows:

  1. The request is sent to the WAP gateway under the WAP protocol. The WAP gateway, under the "control" of the WAP device, performs a typical URL request, using HTTP protocol.
  2. The URL request is transmitted via the Internet to the WAP device's IP address. (The mobile operator assigns the device its IP address.)
  3. The request reaches its final destination – that being a web server. The server, in turn, reads the header and processes the WAP document request. PHP code contained within this document is compiled and formatted as necessary (that is, within the document).
  4. The located (and processed) WAP document (deck) is routed back via the WAP gateway, where its contents are compressed into binary data and sent to the WAP-enabled device.

Learning Objectives

In this tutorial you will learn how to:

* Modify the Apache httpd.conf file to accept and serve WML enabled decks.
* Output specific headers via PHP in order to serve WML-enabled decks.
* Pass variables between WML decks.
* Manipulate variables contained within WML decks.
* Make use of basic MySQL functions to provide for database interaction with the wireless web.

You will also be able to apply the following functions:

header(), mail(), include(), date(), mysql_pconnect(), mysql_query(), mysql_fetch_array(),

Wednesday, August 23, 2006

Overview

Wireless Markup Language (WML) is used to communicate with web browsers embedded within wireless devices and is based on XML.

WML, which operates via a Wireless Application Protocol (WAP), is rapidly gaining popularity among developers such as AOL and Yahoo. WML/WAP technology is being developed to provide wireless users with games, information and email services, instant messaging, and a variety of other applications.

This tutorial shows you how you can use PHP in conjunction with WML to serve dynamic content to a WAP-enabled wireless device.

The sample code illustrates several facets of user interaction via a wireless web browser, including:

* Performing basic insertions of dynamic content (such as a date).
* Sending email.
* Interacting with a MySQL database.

Although PHP-enhanced WML applications can be developed and served on any web server, the Apache web server will be featured in this tutorial as the model from which to do so.

Use Serverside Scrpting Language

We have to use any serverside scripting language to make our WAP site dynamic. I will be using PHP as serverside script.

Friday, December 02, 2005

Paragraphs and Line Breaks

A WML card can be set up to display the paragraph and line break functions of WML:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="Paragraphs"> <p>
This is a paragraph
</p>
<p>
This is another
with a line break
</p></card>
</wml>

You can see result in any WAP simulator.

It will look like this

------ Paragraphs ------

This is a paragraph

This is another
with a line break