forked from codeplant/simple-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
Renderer::Links
andi edited this page Aug 19, 2012
·
5 revisions
The links renderer just renders a set of links, wrapped in a div, e.g.
<div class='my_dom_id'>
<a id="books" href="/books">Books</a>
<a id="music" href="/musics" class="selected">Music</a>
<a id="dvds" href="/dvds">Dvds</a>
</div>
The links renderer works best for very simple, one level navigations where you don’t need the extra html list tags (e.g. for a simple footer navigation).
To use this renderer call
render_navigation :renderer => :links
You can pass the following options to render_navigation when using the links renderer:
- :renderer – set to :links to use the links renderer
- :join_with – to specify the character or string which should be used to join your links. The preferred way to visually separate your links it using CSS. Only use :join_with if you want a special character for separation. If you change this option, do not forget to also specify the whitespace around your join character, e.g. :join_with => " | ". It’s safer to use escaped html characters when using special characters. You could even consider to escape the whitespace (:join_with => “ | ”).
Please be aware that the links renderer does NOT render nested navigation. It only renders one level at a time. I.e. to render all the levels, you have to render them separately:
.primary= render_navigation :renderer => :links, :level => 1
.secondary= render_navigation :renderer => :links, :level => 2