SSlogic

From SmartWiki
Revision as of 13:05, 2 June 2009 by Cameron (talk | contribs)

Jump to: navigation, search

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


  • Using @customfield@ instead of smart folder file (like @parent.contract@)
  • Use if sslogic like this:
<!- -@sslogic(‘@type@’=’contact’) - ->
       <!- -@ssattach(after;/files/1234/123/myfilefooter.pdf )- ->

<!--@else-->
     <!- - @ssattach(after;/files/1234/123/myotherfilefooter.pdf )- ->
<!--@end-->