title: Joomla main menu html output
body: <p>I'm trying to edit the output joomla main_menu module so I can make a custom dropdown menu.  At the moment it currently outputs html like this:</p>
  
  <pre><code>&lt;ul class="menu"&gt;
  &lt;li class="active item1" id="current"&gt;&lt;a href="#"&gt;&lt;span&gt;First Level Item &lt;/span&lt;/a&gt;&lt;/li&gt;  
  &lt;li class="parent item63"&gt;&lt;a href="#"&gt;&lt;span&gt;First Level Item Parent&lt;/span&gt;&lt;/a&gt;
  &lt;ul&gt;
    &lt;li class="item60"&gt;&lt;a href="#"&gt;&lt;span&gt;Second Level Item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li class="item69"&gt;&lt;a href="#"&gt;&lt;span&gt;Second Level Item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li class="item64"&gt;&lt;a href="#"&gt;&lt;span&gt;First Level Item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li class="item66"&gt;&lt;a href="#"&gt;&lt;span&gt;First Level Item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p></p>
  
  <p>What I would like to do is remove the span tags for the output.</p>
  
  <p>What I know so far is that if I want to edit the output;  in my template folder I make a directory called 'html' and then inside that a new directory called 'mod___mainmenu' and then a make copy the default.php file from the existing mod_mainmenu folder from the modules directory. All the changes to I make to take file will change the output.</p>
  
  <p>The problem that I'm having is that I can't understand what is happening with the code that is written in the default.php file as it use some XML system that I'm unfamilar with and there are no comments.</p>
  
  <p>If anyone has any ideas that would be super helpful!</p>
  
  <p>Here is the code from the default.php file for the menu:</p>
  
  <pre><code>defined('_JEXEC') or die('Restricted access');
  
  
  if ( ! defined('modMainMenuXMLCallbackDefined') )
  {
  
  function modMainMenuXMLCallback(&amp;$node, $args)
  
  {
      $user   = &amp;JFactory::getUser();
      $menu   = &amp;JSite::getMenu();
      $active = $menu-&gt;getActive();
      $path   = isset($active) ? array_reverse($active-&gt;tree) : null;
  
      if (($args['end']) &amp;&amp; ($node-&gt;attributes('level') &gt;= $args['end']))
      {
          $children = $node-&gt;children();
          foreach ($node-&gt;children() as $child)
          {
              if ($child-&gt;name() == 'ul') {
                  $node-&gt;removeChild($child);
              }
          }
      }
  
  
  
      if ($node-&gt;name() == 'ul') {
          foreach ($node-&gt;children() as $child)
          {
              if ($child-&gt;attributes('access') &gt; $user-&gt;get('aid', 0)) {
                  $node-&gt;removeChild($child);
              }
          }
      }
  
      if (($node-&gt;name() == 'li') &amp;&amp; isset($node-&gt;ul)) {
          $node-&gt;addAttribute('class', 'parent');
      }
  
      if (isset($path) &amp;&amp; in_array($node-&gt;attributes('id'), $path))
      {
          if ($node-&gt;attributes('class')) {
              $node-&gt;addAttribute('class', $node-&gt;attributes('class').' active');
          } else {
              $node-&gt;addAttribute('class', 'active');
          }
      }
      else
      {
          if (isset($args['children']) &amp;&amp; !$args['children'])
          {
              $children = $node-&gt;children();
              foreach ($node-&gt;children() as $child)
              {
                  if ($child-&gt;name() == 'ul') {
                      $node-&gt;removeChild($child);
                  }
              }
          }
      }
  
      if (($node-&gt;name() == 'li') &amp;&amp; ($id = $node-&gt;attributes('id'))) {
          if ($node-&gt;attributes('class')) {
              $node-&gt;addAttribute('class', $node-&gt;attributes('class').' item'.$id);
          } else {
              $node-&gt;addAttribute('class', 'item'.$id);
          }
      }
  
      if (isset($path) &amp;&amp; $node-&gt;attributes('id') == $path[0]) {
          $node-&gt;addAttribute('id', 'current');
      } else {
          $node-&gt;removeAttribute('id');
      }
      $node-&gt;removeAttribute('level');
      $node-&gt;removeAttribute('access');
  }
  
  define('modMainMenuXMLCallbackDefined', true);
  }
  modMainMenuHelper::render($params, 'modMainMenuXMLCallback');
  </code></pre>