Jump to:

1382 Posts in 491 Topics by 521 members

Themes

SilverStripe Forums » Themes » <% if clause in template question %>

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 352 Views
  • TomMiller
    Avatar
    Community Member
    26 Posts

    <% if clause in template question %> Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: <% if clause in template question %> Link to this post

    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.

    352 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.