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 1li>
    [
b]<ul>
    ul>[/b]
  <
li>menu 2li>
    <
ul>
      <
li>sub 1li>
      <
li>sub 2li>
      <
li>sub 3li>
    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

337 user(s) are online (248 user(s) are browsing Support Forums)


Members: 0


Guests: 337


more...

Donat-O-Meter

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

Latest GitHub Commits