Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » If Menu(2) Doesn't Exist do This...

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

Page: 1
Go to End
Author Topic: 1407 Views
  • AlastairW
    Avatar
    Community Member
    5 Posts

    If Menu(2) Doesn't Exist do This... Link to this post

    Hi,

    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" />
    <![endif]-->
    <% 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.

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: If Menu(2) Doesn't Exist do This... Link to this post

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

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

  • AlastairW
    Avatar
    Community Member
    5 Posts

    Re: If Menu(2) Doesn't Exist do This... Link to this post

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

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