Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » if (MenuTitle.XML ...

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

Page: 1
Go to End
Author Topic: 591 Views
  • veksen
    Avatar
    Community Member
    1 Post

    if (MenuTitle.XML ... Link to this post

    Hello, I'd like to target a specific page. I want to load the google maps API on the Contact page.

    Just to test if the variable would work, I'm trying in the Page.ss

          <% if (MenuTitle.XML == "Contact") %>
             <% echo MenuTitle.XML %>
          <% end_if %>

    only to get a Parse error: syntax error, unexpected '}', no matter what I try.

    I feel like I'm missing out on something.

    I will be using this in the head to load the javascript, and as a body onload attribute.

  • JonoM
    Avatar
    Community Member
    103 Posts

    Re: if (MenuTitle.XML ... Link to this post

    Hi Veksen,

    Your templating syntax looks wrong, it's a bit different to standard PHP - please review http://doc.silverstripe.org/sapphire/en/topics/templates

    Try

    <% if MenuTitle = Contact %>
    $MenuTitle
    <% end_if %>

    591 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.