我使用nginx来服务器上我的静态页面。 为了使菜单dynamic地改变相应页面上的class="active" ,我试图使用SSIvariables。 所以我在页面上有这个:
<!--#set var="pageOn" value="floorCare" -->
然后再下降一点:
<!--#include virtual="./includes/header.html" -->
在header.html文件里面,我有:
foo: <!--# if expr="(${pageOn} = floorCare" -->class="active"<!--# endif -->
我的理解(从我今天所读到的)是,这应该工作。 相反,我得到:
foo:[处理指令时发生错误] class =“active”[处理指令时发生错误]
我知道SSI本身正在工作(因为页眉/页脚包括很好,否则)
我错过了什么?
expr= value中有一个额外的括号。
它应该是: expr="${pageOn} = floorCare"或expr="$pageOn = floorCare" ,圆括号不是string之外的允许的语法。