vendredi 22 avril 2016

SSI Expression for simple if else

I just discovered Apache SSI expressions and it seems similar to CGI-BIN/PERL in concept, if not as elegant, but I'm having trouble getting a simple variable assignment and evaluation to happen.

All the resources I'm finding are using more complex examples or strip out all the code around the concept so I can't find syntax examples out there for my situation.

I just want to be able to set a variable (preferably to an integer) and evaluate it. The hope is that the scope of a variable set in a higher file will trickle to the lower files and I can pass variables this way, using web files as scripts.

My current test SSI:

<!--#set var="page" value="0"-->
<!--#if expr="@page == '0'" -->
    <!--#include file="./layout.ssi"-->
<!--#elif expr="@page == '1'" -->
    Eat Me
<!--#else -->
    NOPE!
<!--#endif -->

Aucun commentaire:

Enregistrer un commentaire