Category: xssi

Extended server side include snippets

  • Using SSI to select a day

    You can use SSI to select a specific day, and then carry out an action. You can also determine that action to be carried out at a certain time on that day.

    1. First configure the time format to the day of the year
      <!–#config timefmt=”%j” –>
    2. Then use an SSI to select a specific day
      <!–#if expr=”($DATE_LOCAL = /75/)” –>
      This will select the 15 March in 2012
    3.  You can use SSI to select a number of days.
      <!–#if expr=”($DATE_LOCAL = /75/)||($DATE_LOCAL = /76/)||($DATE_LOCAL = /77/)||($DATE_LOCAL = /78/)||($DATE_LOCAL = /79/)||($DATE_LOCAL = /80/)||($DATE_LOCAL = /81/)” –>
      This will select from day 75 through to day 81
    4. You can also select a specific time within this day
      <!–#if expr=”${DATE_LOCAL} = /296/ “–>
      <!–#if expr=”((${DATE_LOCAL} > 2961659) && (${DATE_LOCAL} < 2961901)) “–>
      This will look at day number 296, and then carry out the command for the time from 1659 local time to 1901 local time based on the server.
  • XSSI if and else statements

    if statement

    <!--#if expr="\"$HTTP_REFERER\" = /abc.net.au/" -->
    Content relevant to that site

    <!--#elif expr="\"$HTTP_REFERER\" = /google.com/" -->
    An ‘or if’ statement

    <!--#else -->
    this else statement is used for all other instances

    <!--#endif -->
    finalise the code with an ‘end statement’

    More complex if statement – SSI conditional based on document URI

    This depends on the URI of the document being referenced.

  • XSSI variables

    Set the variable giving it a value
    <!--#set var='site' value='brisbane'--'>

    In normal use add the variable as an echo
    <!--#echo var='site'-->

    If used within another ssi statement use the ‘$’ parameter
    <--#include virtual='/${site}/include.htm'-->