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.

Template Questions /

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

if (MenuTitle.XML ...


Go to End


2 Posts   1426 Views

Avatar
veksen

Community Member, 1 Post

29 September 2011 at 9:27am

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.

Avatar
JonoM

Community Member, 130 Posts

29 September 2011 at 1:21pm

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 %>