By cloudmine on
Hi,
I'm trying to re-write ony of the functions in Drupal's template.php (Garland theme) in order to show icons instead of Text labels as primary links.
Here is my function:
function phptemplate_menu_links($links) {
if (!count($links)) {
return '';
}
$level_tmp = explode('-', key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-$level\" id=\"main-nav\">\n\n";
foreach ($links as $index => $link) {
$output .= '<li ';
if (stristr($index, 'active')) {
$output .= ' class="active"';
}
$cssid = array_keys($link,$link['title']);
$output .= "id=\"panel" .$cssid. "\"><span class=\"menu-hide\">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, TRUE) ."</span></li>\n";
}
$output .= '</ul>';
return $output;
}
The only problem I have is appropriately setting value for $cssid variable. In HTML source of my site there is something like:
Can somebody help me fix it?
Comments
I forgot to post it in code
I forgot to post it in code markups:
Instead of 'Array', I should have key value of the array, beginning from 0.