WML - Creation WAP of pages
Introduction
Recently huge popularity is got with various wireless devices of access in internet. It is enough to mention, that 2/3 population of the Russian Federation own cellular telephones and the potential audience of visitors internet from mobile devices is wider, than the usual visitors using computers. As against a classical browser which communicates with the server under the report http, mobile devices use the report wap (wireless application protocol). The report wap defines{determines} a set corrected, to which mobile devices should follow both wap-applications, and.
At the moment for creation of wap-pages (the analogue of html-pages for mobile devices) is used or a markup language wml (wireless markup language), or xhtml. Both languages of a marking are based on xml and submit to rules of formatting of the xml-document. xhtml is supported not by all cellular telephones, therefore in given clause{article} will be considered wml.
Here will not be described standard tegi, especially those which not otlichajut`sja from the tags used at creation of usual html-page.s the structure wml the document, and interaction of php-scripts with wml will be considered.
Chapter{Head} 1 " Structure wml the document "
The information in wml contains in so-called decks. Decks is the minimal block of the data which can be transferred{handed} by the server. In decks nakhodjat`sja maps (<card>) in one deck always should be though one map, but can be and a little - restrictions no.
Simple wml page taken with wap.siemens.com.
<? xml version = "l.0"?>
<! doctype wml public " - // wapforum // dtd wml 1.1 // en " " http: // www.wapforum.org/dtd/wml_1.1.xml ">
<wml>
<card title = "siemens">
<p>
<a href = " http: // communication-market.siemens.de/wap "> games and more </a> <br/>
<a href = " http: // communication-market.siemens.de/wap/countries.asp? content=rtlo "> sounds and graphics </a> <br/>
<a href = "/content/index.php? a=a_this*amp; r = "> this is siemens </a> <br/>
<a href = "/content/index.php? a=a_ff_kf_kffy2004*amp; r = "> key figures </a> <br/>
<a href = "/content/index.php? a=a_journal*amp; r = "> siemens journal </a> <br/>
<a href = "/contact/index.php "> contact </a> <br/>
<img src = " http: // server-uk.imrworldwide.com/cgi-bin/wapcount? " alt = ""/>
</p>
</card>
</wml>
<? xml version = "l.0"?> - contains the standard instruction specifying, that before us the xml-document. This tag as specifies the version of language xml, necessary for budujuhhikh expansions of language.
<! doctype wml public " - // wapforum // dtd wml 1.1 // en " "http://www.wapforum.org/dtd/wml_1.1.xml"> - declares type of the document - wml and the address, on which the file with dtd. dtd is located (document type definition) is a file with the description such as the document, separated from the main xml-document and the determining set corrected for the xml-document in which there is on him a link. These two lines anticipate actually elements of language and should contain in each wml-file.
wml - the opening tag, is similar on sense tegu html in html-documents.
card - actually the tag beginning{starting} a map, sootvetstvujuet to a tag body in the html-document, but as against body can potorjat`sja in the document some times.
The note
The new line begins with a tag <br/>. It is important to note, that the slash at the end of the tags which are not having the finishing tag is obligatory in xml documents, differently the analyzer informs on a mistake. All additional data zakryvajut`sja double kovychkami (title = " hello! ").
Deck - <wml> </wml>
Map - <card> </card>
Example of page with several maps:
<? xml version = "l.0"?>
<! doctype wml public " - // wapforum // dtd wml 1.1 // en " " http: // www.wapforum.org/dtd/wml_1.1.xml ">
<wml>
<card title = "card1">
<a href = " * card2 "> go to card2 </a> <br/>
</card>
<card title = "card2">
<a href = " * card1 "> return card1 </a> <br/>
</card>
</wml>
Apparently anything complex ! However it is necessary to remember, that there is a restriction on the general{common} size wml pages about{near} 5~10 kb, depending on model of phone and the operator of cellular communication. Therefore the quantity{amount} of maps should not exceed a reasonable limit.
Chapter{Head} 2 " Dynamic generation ". Konfigurirovanie servers. mime type.
That the usual web-server, for example, apache to transform into the wap-server, it is necessary httpd.conf to find in a configuration file section addtype and to add the following directive
addtype text/vnd.wap.wml .wml.
At dynamic generation of wml-page, it is necessary for browser to send the heading informing, that he deals not with usual html-page, and with a resource intended for mobile devices. It can be carried out by means of function header
<? php
* We send heading which "explains" the client, what is it wml the document
header (" content-type: text/vnd.wap.wml ");
?>
So to generate wml page with the help php it is possible approximately as follows
<? php
* We send heading which "explains" the client, what is it wml the document
header (" content-type: text/vnd.wap.wml ");
*jHHu«s¿¼ page
print '
<? xml version = " 1.0" encoding = "utf-8"?>
<! doctype wml public " - // wapforum // dtd wml 1.1 // en " "http://www.wapforum.org/dtd/wml_1.1.xml">
';
print '
<wml>
<card id = "id1" title = "card1">
hello! people this is my first wml page!
</card>
</wml>
';
?>
The conclusion
In this clause{article} we have met that how to create the elementary wml page. In following clauses{articles} various tags and their application (wml-analogues of elements of management in html-forms) will be considered.
Results of job of wml-pages can be looked through by means of the following browsers: opera, winwap, klondike wap browser.

|