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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

If Menu(2) Doesn't Exist do This...

Go to End

3 Posts   1740 Views


Community Member, 5 Posts

15 April 2010 at 9:17am


I'm trying to load a stylesheet if Menu(2) doesn't exist:

<% if (!isset(Menu(2))) %>
   <!--[if IE 7]>
      <link rel="stylesheet" type="text/css" href="themes/pmb/css/ie7-menu-2-fix.css" />
<% end_if %>

However that code obviously isn't right and I can't figure it out. I'm sure its extremely easy but anyone have a tip? My Googling has failed.



Forum Moderator, 5523 Posts

15 April 2010 at 4:43pm

Edited: 15/04/2010 4:44pm

In SS templates you can simply do the following. isset() is a PHP function

<% if Menu(2) %>
<% else %>


Community Member, 5 Posts

16 April 2010 at 9:15am

Ahh it was super easy. Cheers Will, that completes the website!