docs.roxen.comView this page in a printer friendly mode
DocsRoxen2.1TutorialsIf tags
Copyright © 2001, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

The basics of if-else
If tags syntax
If plugins
A basic example
<if> and <define>
<if supports>
Summary

Summary

This lesson have been treating the Roxen Macro Language (RXML) If tags, used to create dynamic web pages based on conditions. They also make it possible to create web applications in RXML without using any programming language.

The If tags correspond to the if-else control flow statements common in regular programming languages.

If tags statements are built up by six basic tags, <if>, <else>, <elseif>, <then>, <true> and <false>. The general syntax is:



<if plugin1='expr' [and|or plugin2='expr' ...] [not]>
  if block
</if>
[<elseif plugin='expr' ...>
  elseif block
</elseif>]
[<else>
  else block
</else>]

Mandatory attribute to <if> and <elseif> is an If plugin. Logical attributes - and, or and not - adds functionality. Inside the attribute expression, '=', '==', 'is', '!=', '<' and '>' operators are valid.

For proper XML, always close tags



<if match='&var.foo; is foo' />
  or
<if match='&var.foo; is foo'></if>

and give all attributes a value



<if true=''>.

The If plugins are divided into five categories, Eval, Match, State, Utils and SiteBuilder, according to their function. Eval plugins evaluate expressions as in regular programming languages, Match plugins match contents with arguments given and State plugins check which of the conditions possible is met. Utils plugins perform specific tests such as present date or time. SiteBuilder plugins require a Roxen Platform SiteBuilder and add test capabilities to web pages contained in a SiteBuilder.


<set variable='var.foo' value = '1' />

<if variable='var.foo = 1'>
  foo = 1
</if>
<else>
  foo is something else
</else>
foo = 1

Here is an example of a simple if-else with RXML <if> and the Eval plugin Variable.

References

Roxen Web Site Creator Manual
http://docs.roxen.com/roxen/2.1/creator/

Roxen Macro Language (RXML)
http://docs.roxen.com/roxen/2.1/creator/rxml/

Roxen Administrator Manual
http://docs.roxen.com/roxen/2.1/administrator/

HTML 4.01 Specification by W3C
http://www.w3.org/TR/html401/

XML 1.0 Specification by W3C
http://www.w3.org/TR/REC-xml

XSL Specification by W3C
http://www.w3.org/TR/xsl/

XSLT Specification by W3C
http://www.w3.org/TR/xslt

Netscape JavaScript Reference
http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm

If you have any questions, suggestions, comments or complaints about this lesson, please send an e-mail to manuals@roxen.com.