IntroductionWhat is SSI
What you need
Setting up SSI
If / Then / Else
PrintenvThe printenv command displays all of the system variables and their values.
SetThis allows you to set the value of a variable, and is useful in confunction with the if/then/else directives.
<--#set var="varname" value="data" -->
If / Then / ElseThese allow you to select different things to display, base on the contents of the various variables. For example, you might want to do something different for users whose HTTP_USER_AGENT contains "MSIE" (i.e. Internet Explorer Users) than for those who use Netscape. Or maybe you could use this in a template file for a collapsable menu, and expand the appropriate section by using the
<!--#if expr="condition" --> (this is displayed if first condition is met) <!--#elif expr="condition" --> (otherwise this is displayed if second condition is met) <!--#else --> (if neither condition is met, this is displayed) <!--#endif -->The condition is a comparison between two strings, using the operators =, != (not equals), <, <=, >, and >=
Compound conditions can be made by using
For information on how to compare the contents of variables, see the next section.
Variable SubstitutionTo use a variable's data as the value to be displayed or compared, or the file to be accessed, simply enter the variable name with a $ sign in front of it.
<--#if expr="$varname = 'test'" -->If the variable