4.12 :: Rules

Description


You can setup rules inside WAPL to allow functionality based on rules that either pass or fail.

For example, if you only want certain functionality if the visitor is using an iPhone, wrap an iphone test around your <row>, <cell> or any other element.

Quick Example


..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <layout>
  3.   <rule type="activation" criteria="iphone" condition="1">
  4.   <row>
  5.   <cell>
  6.   <chars>
  7.   <value>Hello World if i am an iPhone!</value>
  8.   </chars>
  9.   </cell>
  10.   </row>
  11.   </rule>
  12.   </layout>
  13.  </wapl>

Attributes


type


Determines if the rule will activate or supress it's content if the rule is passed as true. Value is either activation or supression. If an activation rule is passed, all content inside the rule will be parsed.

Options: "activation", "suppression"

Example:

<rule type="activation">
...
</rule>

criteria


The type of rule. The condition itself. Some criteria use an additional value against which the condition is evaluated.

DescriptionCriteriaValue
Videos Supportedvideocapable
Tones Supportedaudiocapable
Images Supportedimagecapable
Java Supportedjava_enabled
A Gallery Set Is Openset_open
User Is Registeredlogged_in
Auto Spend Activeauto_spend
Transaction Has Occurredtransaction
Delivery MSISDN Retrieveddelivery_msisdn
Is An IPhoneiphone
Specific token presenttokenCanvas Token id
Form has been completedformCanvas Form id
Campaign Activecampaign_running
Specific Campaign ActivecampaignCanvas Campaign id
Language islanguageISO2 Language
Subscribed TosubscriptionCanvas subscription point id
Affiliate Activeaffilliate_running
Affiliate Is:affiliateCanvas affiliate id
DRM enableddrm_enabled
Is I-Modeis_imode
Flash enabledflashenabled
JavaScript Supportedjavascript_enabled
CSS Supportedcss
User Is Wapple Recognisedwui
Location islocationRegion id
Country iscountryISO2 Country
Region is regionISO2 Region
Inside IP range:iprangeIP range id
Day Isdayofweek1 (Mon) - 7 (Sun)
Month Ismonth1 (Jan) - 12(Dec)
Device Supports MIMEdevicecapableaudio_mp3
audio_wav
audio_amr
audio_awb
audio_3gp
audio_mmf
audio_rmf
audio_mid
audio_qcp
audio_imelody
Screen Width is equal toscreenxeqnumber of pixels
Screen Width is less thanscreenxltnumber of pixels
Screen Width is less than or equal toscreenxlteqnumber of pixels
Screen Width is greater than or equal toscreenxgteqnumber of pixels
Screen Width is greater thanscreenxgtnumber of pixels


Example:

<rule criteria="iphone">
...
</rule>

condition


Determines if the rule is passed on the criteria, and value where appropriate being true (1) or false (0).

Options: "0", "1"

Example:

<rule condition="1">
...
</rule>

value


When used with activation/suppression rules that require a value (such as screen width), you can specify a value to activate or suppress on.

Example:

<rule type="activation" criteria="screenxlt" condition="1" value="200">
...
</rule>

Detailed Example


..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <layout>
  3.   <rule type="activation" criteria="iphone" condition="1">
  4.   <row>
  5.   <cell>
  6.   <chars>
  7.   <value>Hello World if i am an iPhone!</value>
  8.   </chars>
  9.   </cell>
  10.   </row>
  11.   </rule>
  12.   </layout>
  13.  </wapl>

Contents