Using the last Liferay post, Liferay Layouts – Dynamic Layouts and Cross Context Parsing, the following should be easy to implement.
The code that follows can be included in a Liferay layout (or set of them) to produce secondary and tertiary navigation. Like most of my examples, there are a bunch of techniques at work here, each of which can be rolled over into other uses. Note the use of #define (which can be useful during iterative development in environments where macros are cached) and the use of XML for navigating across the hierarchy of navigation items to produce logical subsets.
#* =========================================
OVERVIEW
createNavItemXML is called when $createNavXML is evaluated below; It's a recursive
fucntion for generating "nodes".
$createNavXML is simply a #defined piece of Velo.
The pair work together to create an XML document ($navXML) that we read and operate
on using saxReaderUtil. This is basically a theme-level extension of navItem, since
we gain the ability to dissect the hierarchy and traverse up and down as necessary
(using XPATH). Also, we can pass this xml string to other components, like the theme,
so we don't have to iterate over the $nav_items collection multiple times.
========================================= *#
#macro (createNavItemXML24 $nav_item $level)
#set ($selected = '')
#if ($stringUtil.lowerCase($nav_item.getURL()) == $stringUtil.lowerCase($current_path))
#set ($selected = 'selected="selected"')
#end
<navitem url="$htmlUtil.escape($nav_item.getURL())"
title="$htmlUtil.escape($nav_item.getTitle())"
$selected target="$htmlUtil.escape($nav_item.getTarget())"
level="$level" name="$nav_item.getName()">
$stringUtil.trim($nav_item.getName())
#if ($nav_item.hasChildren())
#if ($level == 1)
#set ($nextLevel = 2)
#elseif ($level == 2)
#set ($nextLevel = 3)
#elseif ($level == 3)
#set ($nextLevel = 4)
#else
#set ($nextLevel = 'U')
#end
#foreach ($nav_child in $nav_item.getChildren())
#createNavItemXML24($nav_child $nextLevel)
#end
#if ($level == 4)
#set ($nextLevel = 3)
#elseif ($level == 3)
#set ($nextLevel = 2)
#elseif ($level == 2)
#set ($nextLevel = 1)
#else
#set ($nextLevel = 'U')
#end
#end
</navitem>
#end
#define ($createNavXML)
<?xml version="1.0"?>
<navigation>
#foreach ($nav_item in $navItems)
#createNavItemXML24($nav_item 1)
#end
</navigation>
#end
#define ($secondaryNav)
<ul>
#foreach ($node in $secondary)
<li class="$!node.attributeValue('selected')"><a href='$node.attributeValue('url')'>$node.attributeValue('name')</a></li>
#end
</u>
#end
#define ($tertiaryNav)
<ul>
#foreach ($node in $tertiary)
<li class="$!node.attributeValue('selected')"><a href='$node.attributeValue('url')'>$node.attributeValue('name')</a></li>
#end
</u>
#end
## READ IN XML, CREATE ROOTNODE, GET NODE LIST
#set ($navXML = "#evaluate($createNavXML)")
#set ($rootNode = $!saxReaderUtil.read($navXML).getRootElement())
#set ($nodes = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']", $rootNode))
#* =========================================
LEVEL (A node attribute)
The level attribute tells us where we are in the hierarchy. Level 1 is the primary
nav. Level 2 is the secondary nav (if any). Level 3 is the tertiary nav (if any).
========================================= *#
#set ($activeLevel = $nodes.get(0).attributeValue('level'))
#if ($activeLevel == 1)
#set ($secondary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/navitem", $rootNode))
#set ($tertiary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/navitem[1]/navitem", $rootNode))
#elseif ($activeLevel == 2)
#set ($secondary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/../navitem", $rootNode))
#set ($tertiary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/navitem", $rootNode))
#elseif ($activeLevel == 3)
#set ($secondary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/../../navitem", $rootNode))
#set ($tertiary = $!saxReaderUtil.selectNodes("//navitem[@selected='selected']/../navitem", $rootNode))
#else
#set ($secondary = "")
#set ($tertiary = "")
#end
<style>
li.selected a {
font-size: 12px;
font-weight: bold;
color: green;
}
</style>
#evaluate($secondaryNav)
#evaluate($tertiaryNav)
#*
<h2>XML OUTPUT</h2>
$htmlUtil.escape($navXML)
*#
Some bits of this code are inefficient simply because no better way exists. Some bits of this code are inefficient because not all velocity-enabled environments will provide the same utilities. In some cases, macros have no local scope, for example.

