Item management: Conditional items
|
|||
|
Item management: Conditional items
The TT Web Site Manager supports a simple one layer conditional item as well as the normal PHP conditionals that can be used in PHP items. In a PHP file you might do something like this:
if ($thing_that_matters == "true"){ Now imagine that you wanted to process a load of TT Web Site Manager items if your condition was true instead. Unfortunately it is impossible to extend a PHP conditional between TT Web Site Manager items so the TT Web Site Manager has a built in conditonal format of its own. First, you create a conditional start item containing your conditional code, then you put the items you wish to process if your conditional code is true after the conditional item, and finally you terminate it all with a conditional end item. An example extract from a page contents is shown below.
Here the conditional item checks to see whether a form variable contains the string "Delete story", and allows the TT Web Site Manager to move on to the next item which executes an SQL query to delete a line from a database if "Delete story" has been returned. The conditional end item tells the TT Web Site Manager that it is back to business as usual at the end of the conditional block. These conditionals suffer only one drawback, they can not be nested. A typical conditional item is shown below. The code is simply a PHP conditional expression.
You should not need to create more than one conditional end item, they are all identical since they contain no code of their own. A conditional end item is shown below.
|
||||||||||||||||||||||||
|