function phptemplate_links
($links,
$attributes =
array('class' =>
'links')) {
$output = '';
$num_links =
count($links);
$i = 1;
foreach ($links as $key => $link) {
$class = $key;
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class .= ' first';
}
if ($i == $num_links) {
$class .= ' last';
}
$class .= ' active';
}
$output .= '<li class="'. $class .'">';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .=
'<div>'.
l($link['title'],
$link['href'],
$link) .
'</div>';
}
else if (!
empty($link['title'])) {
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (empty($link['html'])) {
}
$span_attributes = '';
if (isset($link['attributes'])) {
}
$output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
}
$i++;
$output .= "</li>\n";
}
$output .= '</ul>';
}
return $output;
}