Jump to:

1385 Posts in 493 Topics by 522 members


SilverStripe Forums » Themes » Control Blocks and special classes

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 1647 Views
  • papilindo
    Community Member
    1 Post

    Control Blocks and special classes Link to this post

    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

  • Nivanka
    Community Member
    395 Posts

    Re: Control Blocks and special classes Link to this post

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

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.