Difference between revisions of "SSlogic"
Line 1: | Line 1: | ||
− | |||
Web Page View fields can use a unique SmartSimple logic interpreter. Web page logic gives you the ability to display certain content or perform certain actions only when specified conditions are met. | Web Page View fields can use a unique SmartSimple logic interpreter. Web page logic gives you the ability to display certain content or perform certain actions only when specified conditions are met. | ||
SmartSimple logic follows the following template:<br> | SmartSimple logic follows the following template:<br> | ||
Line 20: | Line 19: | ||
You are a girl.<br> | You are a girl.<br> | ||
<!--@end--><br> | <!--@end--><br> | ||
+ | |||
+ | [[Category:Custom Fields]] |
Revision as of 11:56, 2 June 2009
Web Page View fields can use a unique SmartSimple logic interpreter. Web page logic gives you the ability to display certain content or perform certain actions only when specified conditions are met.
SmartSimple logic follows the following template:
<!--@sslogic(CONDITION)-->
The content to be displayed when condition is true
<!--@end-->
Condition is replaced with the logical condition that your case calls for. The following code sample will display a Christmas tree image if and only if it is currently December:
<!--@sslogic(month(now())=12)-->
<img src='images/xmasstree.jpg'>
<!--@end-->
Note that the content to be displayed (the middle line) can either be in plaintext or in HTML.
Often, you will want to display one of two texts--one text in the case that a condition is met and another in the case that the condition is not met. This is achieved through the use of an "else" operator.
The following sample code will display one message if a user is male and another if the user is female:
<!--@sslogic('@sex@'='M')-->
You are a guy.
<!--@else-->
You are a girl.
<!--@end-->