Creating WAP pages

By using Saurus templates, you can create any type of user interfaces from the data stored in the database. This includes HTML, XML, RSS, WML etc. Just apply your template to one of the web sections and visit the section with your mobile phone.

We suggest to tick the checkbox "Hide in menu" in section editor and also use an alias. This way you can create page www.site.com/wap for example  which is not visible in site menus. You can use free Klondike browser to test your WML code.

The following WAP example displays the 5 newest articles from section with ID=1234 in WML format.

{* This is an example of page template for Saurus CMS for acessing articles from one section via the WAP interfrace from mobile devices *}

{* The code must begin with this row, which sends correct WAP header to the phone. Function insert_header() as described in http://smarty.php.net/manual/en/tips.wap.php is included in SAPI from Saurus CMS version 3.2.8 *}
{insert name=header content="Content-Type: text/vnd.wap.wml"}

{* Output the beginning of the WML code with correct encoding type ({$encoding}) We must define <? ?> being literal, otherwise they are supposed to be PHP code *}
{literal}<?xml version="1.0" encoding="{/literal}{$encoding}{literal}"?>{/literal}

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

{* First card, the index page. This shows the first 5 titles of the articles from section with id=1168 *}
<card id="index" title="{$title|truncate:20:"...":true}">
    <p>
    <strong>Article list</strong><br/>
    {init_articlelist name="articles" parent="1234" limit="5" order="date desc"}
    {foreach from=$articles item=article}
        <anchor title="{$article->title|truncate:20:"...":true}">
        <go href="#{$article->id}"></go>
        </anchor><br/>
    {/foreach}
    </p>
</card>

{* Generate card for each article, showing title, date, lead and link back to the index page *} {init_articlelist name="articles" parent="1234" limit="5"}
{foreach from=$articles item=article}
    {init_article id=$article->id name="art"}
    <card id="{$article->id}" title="{$article->title|truncate:30:"...":true}">
    <p>
    <strong>{$article->title}</strong><br/>
    {$article->date}<br/>   
    {* We are using Smarty strip_tags function to get rid of all HTML tags in the article text. *}
    {$art->lead|strip_tags}<br/>
    <anchor title="Back">
    <go href="#index"></go>
    </anchor>
    </p>
    </card>
{/foreach}

</wml>

Site development

About Saurus API / Creating page template tutorial / Creating content template tutorial / Applying custom design to page template checklist / Site and Article editor CSS styles / Using PHP in templates / Profiles and Custom Assets / Site languages / Printer friendly pages / Site cache / Page compression / Enabling browser cache / Creating WAP pages / Configuring sitemap / Saurus 4.1 technical notes