Joomla web development, eMarketing and training
Home Joomla 1.5 Web Development Tutorials Remove table from horizontal menu option
Joomla 1.5 Web Development
Remove table from horizontal menu option
Wednesday, 01 October 2008 17:40

Remove table from Horizontal Menu format

Question:  I want to remove the table related to the horizontal menu layout for any given menu item.  How do I do it?

Answer:
You could use the list function with a menu suffix and edit the related CSS accordingly to achieve what you want without editing the core system files.

If you do not wish to do that, then open modules > main_menu > legacy.php

Around line 380 find:

echo '<table width="100%" border="0" cellpadding="0" cellspacing="1">';
                        echo '<tr>';
                        echo '<td nowrap="nowrap">';

                        if ($spacer_end) {
                              echo '<span class="' . $menuclass . '"> ' . $spacer_end . ' </span>';
                        }

                        if ($spacer_start) {
                              $html = '<span class="' . $menuclass . '"> ' . $spacer_start . ' </span>';
                              echo implode($html, $links);
                        } else {
                              echo implode('', $links);
                        }

                        if ($spacer_end) {
                              echo '<span class="' . $menuclass . '"> ' . $spacer_end . ' </span>';
                        }

                        echo '</td>';
                        echo '</tr>';
                        echo '</table>';

Remove the echo lines. Or, just remove the table related mark up.  Could look like this:

                        if ($spacer_end) {
                              echo '<span class="' . $menuclass . '"> ' . $spacer_end . ' </span>';
                        }

                        if ($spacer_start) {
                              $html = '<span class="' . $menuclass . '"> ' . $spacer_start . ' </span>';
                              echo implode($html, $links);
                        } else {
                              echo implode('', $links);
                        }

                        if ($spacer_end) {
                              echo '<span class="' . $menuclass . '"> ' . $spacer_end . ' </span>';
                        }

Note: Removing as many of the "tables" from the default Joomla 1.5 systems is a good thing as it reduces code bloat. Though, in this case, if you menues are long, using an unordered list could actually increase the code bloat.

 

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:



+ Suggested tags