[Sputnik-list] Flat menu bar

Jérôme Vuarand jerome.vuarand at gmail.com
Tue Feb 12 06:01:20 GMT+2 2008


Hi list,

As promised in another mail you can find attached my patch to have a
flat tool bar. It creates a new $flat_nav_bar cosmo template in MAIN.
It uses the sputnik template FLAT_NAV_BAR. As an example here is the
one I use on my website:

FLAT_NAV_BAR = [===[
$do_sections[=[
<span id='$id'>$label&nbsp;:
$do_subsections[[<span class='$class'><a $link>$label</a> &middot;
</span>]],[[<span class='$class'><a $link>$label</a></span>]]
-</span>
]=],[=[
<span id='$id'>$label&nbsp;:
$do_subsections[[<span class='$class'><a $link>$label</a> &middot;
</span>]],[[<span class='$class'><a $link>$label</a></span>]]
</span>
]=]]===]

This gives a horizontal menu of the form:

section1 : subsection1 · subsection2 · subsection3 - section2 :
subsection1 · subsection2 · subsection3

Here is a list of differences with the default $nav_bar template:
- it takes two alternative subtemplates, the second one being used for
the last menu element of its kind [1]
- it uses node.templates.NAVIGATION_BAR if it exists, and falls back
to sputnik.config.DEFAULT_NAVIGATION_BAR like the default navbar ;
this let you have a per-template navigation bar (I use that to
differentiate my normal pages from my config pages)

[1] I don't know if there's a convention to create sequences of
elements with a separator string like the standard Lua function
table.concat. I decided to use "subtemplates alternatives" body/tail,
but other solution exist (alternatives head/body, head/body/tail,
subtemplates $if_first/$if_last, etc.). It would ease sharing of
templates if we could agree on the best syntax for these (rather
common) cases.

(I understand this email may seem rather messy, feel free to ask for
further explanations or the URL of my website)

Bye, Doub.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flatbar.patch
Type: application/octet-stream
Size: 3427 bytes
Desc: not available
Url : http://lists.luaforge.net/pipermail/sputnik-list/attachments/20080212/14fd774d/flatbar-0001.obj


More information about the Sputnik-list mailing list