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:

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