.mN - Number N is the depth of this node. Examples: m3, m12
.first - This node is the first node of this depth.
.last - This node is the last node of this depth.
How to use:
1. Create an UDT with name: menu_classes
Code: Select all
global $smarty;
$nodes=isset($params['nodelist']) ? $params['nodelist'] : false;
// h=hierarchy, d=depth, c=class, t=total
// s=search, i=index, p=position, l=leave
if ($nodes != false){
	$h='';
	$d='';
	foreach ($nodes as $node){
		$h .= $node->hierarchy.' ';
		$d .= $node->depth.' ';
	}
	$ha=explode(' ',trim($h));
	$da=explode(' ',trim($d));
	$c='';
	$t=count($ha);
	for ($i=0; $i<$t; $i++){
		if ($da[$i]==1){
			$s=1+$ha[$i];
		}else{
			$p=strrpos($ha[$i],".");
			$l=1+substr($ha[$i],$p+1);
			$s=substr($ha[$i],0,$p).'.'.$l;
		}
		$c .= 'm'.$da[$i];
		if ($i == 0){$c .= ' first';}elseif ($da[$i] > $da[$i-1]){$c .= ' first';}
		if (array_search($s, $ha) == false){$c .= ' last';}
		if ($i < $t-1){$c .= '|';}
	}
	$ca=explode('|',$c);
	$smarty->assign('firstlast',$ca);
}Put {menu_classes nodelist="$nodelist"} below {if $count > 0}
Note the key=key in {foreach ....}
Code: Select all
{if $count > 0}
{menu_classes nodelist="$nodelist"}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach key=key from=$nodelist item=node}
.....Code: Select all
<li class="{$firstlast.$key}">
<a class="{$firstlast.$key}" href="...">
<span class="{$firstlast.$key}">Please let me know if you have a nicer solution.

 
						
 
 
