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:

  • Blog
  • Can somebody help me fix it?

    Comments

    cloudmine’s picture

    I forgot to post it in code markups:

    <li id="panelArray"><a href="/1r2/blog" rel="nofollow">Blog</a></li>
    

    Instead of 'Array', I should have key value of the array, beginning from 0.