Developer forum

Forum » Templates » Remove div for submenu if there is no submenu

Remove div for submenu if there is no submenu

Martin Nonbo
Reply
 I have a div to control and style a submenu, similar to following html:
 
<div id="submenu">
   <div id="position">
      <ul class="dwnavigation" id="dwnav_2" settings="startlevel:2;endlevel:2;">
        <li><a href="#">punkt et</a></li>
        <li><a href="#">punkt to</a></li>
        <li><a href="#">punkt tre</a></li>
        <li><a href="#">punkt fire</a></li>
      </ul>
   </div>
</div>

I would like that the div with the id "submenu" is hidden, if there is no subpages to the relevant "main" page. Can this be done without javascript?
E.g with if:defined? Has anyone got an idea to how this can be solved?

Replies

 
Nuno Aguiar
Reply
This post has been marked as an answer
Hi Martin,

Check the .parsed file to see how the tag looks like, but should simply be like this:
<!--@If Defined(DwNavigation(dwnav_2))-->
  <div id="submenu">
   <div id="position">
      <ul class="dwnavigation" id="dwnav_2" settings="startlevel:2;endlevel:2;">
        <li><a href="#">punkt et</a></li>
        <li><a href="#">punkt to</a></li>
        <li><a href="#">punkt tre</a></li>
        <li><a href="#">punkt fire</a></li>
      </ul>
   </div>
  </div>
<!--@EndIf(DwNavigation(dwnav_2))-->
Best Regards,
Nuno

Votes for this answer: 0

 

You must be logged in to post in the forum