Theme output of submenu I have a menu that should look like this:

&lt;ul class="subpagemenu"&gt;
&lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


You can see, that the first ul has a class and the submenu ul doesn't have. 

I am using this code to add class to the ul.

function mytheme_menu_tree__menu_mymenu($variables) {
    return '&lt;ul class="subpagemenu"&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}


But it adds that class to the all submenus.

&lt;ul class="subpagemenu"&gt;
&lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;
  &lt;ul class="subpagemenu"&gt;
  &lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="xx"&gt;xx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


Is there any way to theme the sub menu? Thank you.
function mytheme_menu_tree__menu_mymenu($variables) {
  return '&lt;ul class="subpagemenu"&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}

function mytheme_menu_tree__menu_mymenu_second($variables) {
  return '&lt;ul&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}

function mytheme_menu_link__menu_mymenu($variables) {
  $element = $variables['element'];

  $submenu = '';
  if ($element['#below']) {
    // You can set a theme wrapper here or put an empty array() only
    // and theme the second level directly by adding &lt;ul&gt;&lt;/ul&gt; one line below.
    $element['#below']['#theme_wrappers'] = array('menu_tree__menu_mymenu_second');
    $submenu = drupal_render($element['#below']);
  }

  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '&lt;li' . drupal_attributes($element['#attributes']) . '&gt;' . $output . $submenu . "&lt;/li&gt;\n";
}