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.

Archive /

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

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

if with or, or somethings else ;-)


Go to End


4 Posts   2891 Views

Avatar
UnrealMinds

Community Member, 8 Posts

12 May 2008 at 5:50am

Edited: 16/05/2008 1:51am

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. ;-)

Avatar
UnrealMinds

Community Member, 8 Posts

16 May 2008 at 1:52am

does no one have an idea?

Avatar
Bruce B

Community Member, 164 Posts

16 May 2008 at 11:04am

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

Avatar
UnrealMinds

Community Member, 8 Posts

16 May 2008 at 7:03pm

Thanx, for this idea.

I will try to do so ;-)