SilverStripe: Parse error: syntax error, unexpected right curly bracket
From FVue
Contents
Problem
I want to access this property from within my SilverStripe template:
<% if Top.Controller.activeStep == 2 %> <p>Step 2</p> <% end_if %>
but it's given me this error:
Parse error: syntax error, unexpected '}' in /tmp/silverstripe-cache/...
Environment
- SilverStripe-2.4.5
Workaround
Add a controller method isActiveStep2:
function isActiveStep2() { return 2 == $this->activeStep; }
Access the controller method from within the template like this:
<% if Top.Controller.isActiveStep2 %> <p>Step 2</p> <% end_if %>
Advertisement