If module

Edit | Tags | Source | Print

Posted 1253109038|%O ago by leigerleiger
Based on graphmastur's very ambitious weneed:102, this is the beginnings of a design document for the theoretical If module.

Syntax

[[module If attributes]]
Code to be generated if the attribute requirements are met
[[/module]]

Display

When a page is saved, the position in the page that holds the module will display either the specified code, or nothing at all if the attribute requirements are not met.

Attributes

More than one of these may be activated within the same instance of the module. For example:

[[module If user="anonymous" localtime="9.5"]]
You are an **anonymous** user that is located in **Central Australia**
[[/module]]

Most of these can be interpreted as a list, and are additive. However, this should also be supported:

[[module If browser="-firefox -opera -chrome -safari -ie"]]
I have no idea what browser you're using!!
[[/module]]

Name Options Description
index index="valid positive integer list"
index="1 2 3 7 8 9 13 14 15"
index="odd|even"
One of the most powerful uses of the If module, this should work within ListPages and will check the value of the 'index' variable
member_role member_role="anonymous"
member_role="registered"
member_role="member"
member_role="moderator"
member_role="administrator"
Another of the most powerful uses of the If module, this allows to check what type of user is currently viewing the page!!
member_flags member_flags="member_flags-identifier" See Ed Johnson's post for further details
tags tags="list of tags" To replace the current [[iftags tags]] syntax
browser browser="browser-identifier" Is the specified browser being used?
os os="os-identifier" Is the specified Operating System being used?
localtime localtime="GMT modifier"
localtime="-5"
localtime="0"
localtime=+5"
Checks what the local time is for the current user's computer clock. localtime=+5 represents a time five hours ahead of Greenwich Mean Time.
Add a New Comment