WAP: Part 6 - Microbrowser content in WML / XHTML MP
WML
WML is probably the lowest common denominator of microbrowser content formats. If you can assume you're not going to support older phones that only can display WML, you might decide to only display your content in XHTML MP (Mobile Profile).
WML is a different paradigm of web design, which encompasses multiple pages (cards) contained in a single document (deck). A brief and easy introduction into WAP and WML can be found at w3schools. Read all of it.
Once you've read all of that, there's more in-depth WML information and tutorials at http://www.developershome.com/wap/wml/. Specifically you'll at least want to check out how to submit form data in WML.
WML in Firefox
To test WML in Firefox, you'll want two plugins: WML Browser and Modify Headers. Modify Headers is used to append 'text/vnd.wap.wml' to the Accept header -- indicating that Firefox somehow now knows how to render WML. You can also use Modify Headers to change the User-Agent header, which is not strictly needed, but if your WAP site is utilizing the WURFL to determine device capabilities, then it may be useful to 'virtually' test different devices (see my previous WURFL article). WML has an extremely strict syntax, so it is best to test pages in Firefox using the WML Browser as it will more verbose in reporting errors, where as your phone will probably just display nothing.
XHTML MP
XHTML MP is really just strict XHTML with some limitations. You must always close your tags, they must be in lower case, attributes must be
enclosed in quotes, etc. etc. Go through the documentation provided here for details.
To test XHTML MP in a 'big' browser you don't have to do anything in particular since XHTML MP is really a subset of XHTML. If you're using something like the WURFL to redirect to a 'full' site based on User-Agent, you might add something in your code to force to XHTML MP mode.
Dynamically changing format with XSLT
You could probably dynamically change from WML to XHTML MP by using XSLT but I've found it simpler to maintain seperate files. In a
multi-page site this could quickly get out of hand. So for a primer here is an article that uses PHP, WURFL & XSLT to translate pages between XHTML MP and WML.
Articles In This Series:
WAP: Part 1 - MultiTech USB GPRS Modem in Linux
WAP: Part 2 - Send SMS from Kannel
WAP: Part 3 - WAP Push with Kannel & PHP
WAP: Part 4 - Send SMS from PHP
WAP: Part 5 - Customizing content with WURFL
WAP: Part 6 - Microbrowser content in WML / XHTML MP
