Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » if with or, or somethings else ;-)

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2252 Views
  • UnrealMinds
    Avatar
    Community Member
    8 Posts

    if with or, or somethings else ;-) Link to this post

    Hello @all!

    I have a simple menu, but I wanted to have some spaces between at some positions.

    like:
    ***********
    Home
    <br />
    Contact
    Impress
    <br />
    News
    ***********

    So, I have to inklude:
    <% if Pos = 2 %>
    <li style="height: 5px;">&nbsp;</li>
    <% end_if %>

    But for the secound spacer I wouldn't like to write:
    <% if Pos = 4 %>
    <li style="height: 5px;">&nbsp;</li>
    <% end_if %>

    How can I made this with only one if-statement?

    <% if Pos = 2 || Pos = 4 %>
    <% if (Pos = 2) || (Pos = 4) %>
    <% if Pos = 2 or Pos = 4 %>
    <% if (Pos = 2) or (Pos = 4) %>
    has the only effect that the site will be blank. ;-)

  • UnrealMinds
    Avatar
    Community Member
    8 Posts

    Re: if with or, or somethings else ;-) Link to this post

    does no one have an idea?

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: if with or, or somethings else ;-) Link to this post

    Are the breaks determined by the menu items themselves or just the position? If its the menu items, you could add a new field to the relevant page type called 'MenuSpace', then use the value of that field in your if statement to decide whether to insert a space above the item.

    cheers
    bruce

  • UnrealMinds
    Avatar
    Community Member
    8 Posts

    Re: if with or, or somethings else ;-) Link to this post

    Thanx, for this idea.

    I will try to do so ;-)

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