1
russtik
Modifying Menu Templates
  • 2005/2/2 11:33

  • russtik

  • Just popping in

  • Posts: 70

  • Since: 2004/8/13


Hello,

I would like to modify the core menu templates which in there standard state utilise tables. I intend to use an unordered list structure in replace of this:

<ul id="mainmenu">
  <{foreach 
item=module from=$block.modules}>
  <
li><class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/"><{$module.name}></a></li>
    <
ul>
    <{foreach 
item=sublink from=$module.sublinks}>
    <
li><class="menuSub" href="<{$sublink.url}>"><{$sublink.name}></a></li>
    <{/foreach}>
    </
ul>
  <{/foreach}>
</
ul>


The problem with the above code is that if a menu item doesn't have an attached submenu, it leaves unused < ul > tags in the markup which I don't want.

E.g.
<ul id="mainmenu">
  <
li>menu 1</li>
    [
b]<ul>
    </
ul>[/b]
  <
li>menu 2</li>
    <
ul>
      <
li>sub 1</li>
      <
li>sub 2</li>
      <
li>sub 3</li>
    </
ul>
</
ul>


Does anyone know how to include a conditional statement that says something like if (there is a submenu) show < ul > tags else hide them, or any other solution?

Login

Who's Online

158 user(s) are online (128 user(s) are browsing Support Forums)


Members: 0


Guests: 158


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits