docs.roxen.comBack to normal mode
DocsRoxen2.2Web Site Creator ManualIf Tags
Copyright © 2004, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com

<if></if>

Provided by module: Tags: RXML 2 tags

<if> is used to conditionally show its contents.The <if> tag is used to conditionally show its contents. <else> or <elseif> can be used to suggest alternative content.

It is possible to use glob patterns in almost all attributes, where * means match zero or more characters while ? matches one character. * Thus t*f?? will match trainfoo as well as * tfoo but not trainfork or tfo. It is not possible to use regexp's together with any of the if-plugins.

The tag itself is useless without its plugins. Its main functionality is to provide a framework for the plugins.

It is mandatory to add a plugin as one attribute. The other attributes provided are and, or and not, used for combining plugins or logical negation.


<if variable='var.foo > 0' and='' match='var.bar is No'>
    ...
  </if>

<if variable='var.foo > 0' not=''>
  &var.foo; is less than 0
</if><else>
  &var.foo; is greater than 0
</else>

Operators valid in attribute expressions are: '=', '==', 'is', '!=', '<' and '>'.

The If plugins are sorted according to their function into five categories: Eval, Match, State, Utils and SiteBuilder.

The Eval category is the one corresponding to the regular tests made in programming languages, and perhaps the most used. They evaluate expressions containing variables, entities, strings etc and are a sort of multi-use plugins. All If-tag operators and global patterns are allowed.


<set variable='var.x' value='6'/>
<if variable='var.x > 5'>More than one hand</if>
More than one hand

The Match category contains plugins that match contents of something, e.g. an IP package header, with arguments given to the plugin as a string or a list of strings.


Your domain <if ip='130.236.*'> is </if>
<else> isn't </else> liu.se.
Your domain isn't liu.se.

State plugins check which of the possible states something is in, e.g. if a flag is set or not, if something is supported or not, if something is defined or not etc.


   Your browser
  <if supports='javascript'>
   supports Javascript version &client.javascript;
  </if>
  <else>doesn't support Javascript</else>.
Your browser doesn't support Javascript.

Utils are additonal plugins specialized for certain tests, e.g. date and time tests.


  <if time='1700' after=''>
    Are you still at work?
  </if>
  <elseif time='0900' before=''>
     Wow, you work early!
  </elseif>
  <else>
   Somewhere between 9 to 5.
  </else>

SiteBuilder plugins requires a Roxen Platform SiteBuilder installed to work. They are adding test capabilities to web pages contained in a SiteBuilder administrated site.


Attributes

not

Inverts the result (true->false, false->true).


or

If any criterion is met the result is true.


and

If all criterions are met the result is true. And is default.