Adding different classes to menu item list I'm trying to override the way that menu items are displayed. I have the following function :

 function newtheme_item_list($items = array(),$title=NULL,$type='ul',$attributes=NULL)
 {
 $positions = array("","second","third","forth");
if (!empty($items)) {
$output .= "&lt;$type" . drupal_attributes($attributes) . '&gt;';
foreach ($items as $item_key=&gt;$item) {
  $attributes = array();
  $children = array();
  if (is_array($item)) {
    foreach ($item as $key =&gt; $value) {
      if ($key == 'data') {
        $data = $value;
      }
      elseif ($key == 'children') {
        $children = $value;
      }
      else {
        $attributes[$key] = $value;
      }
    }
  }
  else {
    $data = $item;
  }

  if (count($children) &gt; 0) {
    $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list
  }
  if ($item_key &gt; 0)
  {
    $attributes['class'] = ' nav_separator '.$positions[$item_key].'-nav'; 
  }
  if($item_key == 0) {
    $attributes['class'] = 'first-nav';
  } 
  elseif($item_key == count($items)-1){

    $attributes['class'] = ' last-nav';
  }

  $output .= '&lt;li' . drupal_attributes($attributes) . '&gt;'. $data .'&lt;/li&gt;';
}
$output .= "&lt;/$type&gt;";
}
$output .= '&lt;/div&gt;';
return $output;


}


In the page.inc.php i have the line:

print theme('links', array('links' =&gt; menu_navigation_links('main-menu'),'attributes' =&gt; array('class'=&gt; array('links', 'site-menu')))); 


This it should add some different classes to my menu but instead i get this error:

Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in D:\EasyPHP-5.3.5.0\www\drupal\themes\newtheme\template.php on line 12 and defined in drupal_attributes() (line 2301 of D:\EasyPHP-5.3.5.0\www\drupal\includes\common.inc).
Your function signature is off, it should be like this:

function newtheme_item_list($variables) {
  $items = $variables['items'];
  $title = $variables['title'];
  $type = $variables['type'];
  $attributes = $variables['attributes'];
  ..
}


You should check the docs, when creating theme functions.