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

Different CSS for last link in a menu


Go to End


4 Posts   2466 Views

Avatar
Yellow7 Jon

Community Member, 39 Posts

21 June 2008 at 3:31am

Edited: 21/06/2008 3:32am

Say I have 5 links in the main menu, I would like to specify a separate class value for the last link in the list to achieve something like this

Link 1 | link 2 | link 3 | link 4 | link 5

notice the missing "border-right" on link 5...

any help would be greatly appreciated!!

Avatar
thejackel

Community Member, 33 Posts

21 June 2008 at 3:52am

In your control loop insert the following (after the link):

<% if Last %><% else %> | <% end_if %>

It's basically saying, if your at the last item, don't insert a pipe. If your not on th elast item, do insert a pipe!

Avatar
Yellow7 Jon

Community Member, 39 Posts

21 June 2008 at 3:54am

Awesome, I just stumbled upon FirstLast while looking for nested sub menu solution.

Thanks!

is there a "comprehensive" list of things I can use on a page?

Avatar
thejackel

Community Member, 33 Posts

21 June 2008 at 4:02am