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.

Themes /

Discuss SilverStripe Themes.

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

Control Blocks and special classes

Go to End

2 Posts   2088 Views


Community Member, 1 Post

15 May 2009 at 9:08am

Edited: 15/05/2009 9:53am

Hey hows it going guys? I just started using silverstripe its pretty nice I like it. I am trying to use a control block for my nav in the header but I want the first and last items in the nav to have special css classes/styling can this be done and some tips would be much appreciated .Thank you in advance.

Just found out about using < % If first %> but it duplicates the first element !!!!

Ok so I think I solved my own problem

<% control Menu(1) %>
<% if first %>
<li class="wider "><span>&#8195;</span><a href="#">$MenuTitle</a></li>
<% else_if last %>
<li class="wider no_background"><span>&#8195;</span><a href="#">$MenuTitle</a></li>
<% else %>
<li><span>&#8195;</span><a href="#">$MenuTitle</a></li>
<% end_if %>
<% end_control %>

I ended up using ifs and else ifs and it stopped the duplicating

Plz do not mark this as spam I am sure this will help a fellow beginner


Community Member, 400 Posts

24 June 2009 at 5:44pm

this is the way you have to do it, thanks for posting the hack.