Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

<% if clause in template question %>


Go to End


2 Posts   1644 Views

Avatar
TomMiller

Community Member, 26 Posts

19 January 2014 at 1:17am

Edited: 19/01/2014 1:18am

Hi everyone,
my problem:
i wan't t do something in the template when a certain page in navigation is selected. My idea was the following code:

<% if $Top.Title = TopTitleValue %>
<p>Show me something</p>
<% end_if %>

Unfortunately im getting a parse error only: Parse error: syntax error, unexpected '}' in C:\Windows\Temp\silverstripe-cacheC--Program-Files-(x86)-Zend-Apache2-htdocs-ss\.cache.themes.notdienst.templates.Inhalt.ss on line 304

Is there a way to my goal?
I'm using Silverstripe 2.4.
TIA
Tom

Avatar
Willr

Forum Moderator, 5523 Posts

19 January 2014 at 10:20pm

You can do that in 3.* but 2.4 had a much more basic template engine. In 2.4 you will need to make a PHP function to do the comparison.