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.


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


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.


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**

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!!

Name Options Description
index index="valid positive integer list"
index="1 2 3 7 8 9 13 14 15"
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"
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"
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