Hi liquid,
I've just managed to run into the same problem and with abit of looking into what the menu manager can do I came up with a way to find the first and last nodes of a menu.
Finding the first node was pretty simple using the $node->index parameter.
This will give you the count of this node in the whole menu. So if we want the first node, we simply test it against '0' (as items in the menu begin at 0 not 1).
For example, I used the condition:
Code: Select all
{if $node->index == 0}
<li class="first"> <a href="{$node->url}"> {$node->menutext} </a>
That first line simply says if the nodes index is equal to '0', output the line beneath (which has a class of 'first').
Finding the last node was a little more tricky. For this I noticed there was a '$count' parameter. Count seems to add up all the nodes in total.
So to find the last one, I used:
Code: Select all
{if $node->index == $count-1}
<li class="last"> <a href="{$node->url}" > {$node->menutext} </a>
Which says if the nodes index is equal to the total count minus 1 (as the first item is a 0), output the line beneath which has a class of last. [NOTE: I haven't tested this for menus more than 1 level deep, count may output something different]
This should be enough to get you there. You can set IDs and classes as you like. Remember that if you are adding current states to your links (class="here") you will have to combine the arguments.
For example, if a link was both the current link AND the last link you would use:
Code: Select all
{if $node->current == true && $node->index == $count-1}
<li class="last here"> <a href="{$node->url}"> {$node->menutext} </a>
Again, you can change ID and class names to suit.
As a tip, I'd avoid using IDs unless they are unique. If at some point you have more than one list using 'first' or 'last' as IDs then the page will be invalid. IDs are suitable if you're making an image menu and you need to specifically target an item.
Hope this helps. Apologies if this seemed patronising, I'm trying to explain everything fully in case it helps someone else less experienced. I'll also try and add the examples to the wiki soon. If more detailed examples are need, just ask.
