[TYPO3] Transmenu in typo3?

Francois Suter fsuter at cobweb.ch
Mon Jun 30 20:58:26 CEST 2008


Hi,

> I've made these things by adding a custom php script that makes the menu 
> lines directly from 'pages' table (if multilingual, also from 
> 'pages_language_overlay') and all the other stuff (links to .js and .css 
> etc) is in html template. Maybe not so "professional" way but it works 
> and after all, it's not executed every time, it's cached.

I don't want to hurt anyone's feelings, but this is really not a good 
solution. TYPO3 has a TypoScript object of type HMENU which already 
handles all there is to handle for building a hierarchical menu of 
pages. And believe me, it is no trivial task: it is not just about 
language overlays, but for examples also versions and - particularly 
touchy - mount points. So you should really let HMENU do the work. With 
a properly configured HMENU, you can build a <ul>, <li> nested menu 
structure that's totally clean. Here's an example:

lib.topmenu = HMENU
lib.topmenu {
     1 = TMENU
     1 {
         wrap = <ul id="dhtmlmenu">|</ul>
         expAll = 1
         NO.wrapItemAndSub = <li>|</li>
         ACT = 1
         ACT.wrapItemAndSub = <li>|</li>
         ACT.allWrap = <span class="itemact">|</span>
         CUR = 1
         CUR.wrapItemAndSub = <li>|</li>
         CUR.allWrap = <span class="itemcur">|</span>
     }

# Level 2

     2 < .1
     2 {
         wrap = <ul>|</ul>
         IFSUB = 1
         IFSUB.wrapItemAndSub = <li>|</li>
         IFSUB.allWrap = <span class="itemsub">|</span>
         ACTIFSUB < .IFSUB
         ACTIFSUB.allWrap = <span class="itemsub itemact">|</span>
         CURIFSUB < .IFSUB
         CURIFSUB.allWrap = <span class="itemsub itemcur">|</span>
     }

# Level 3

     3 < .2

# Level 4 (repeat as much as necessary)

     4 < .3
}

Then you just need to include the proper CSS file and the necessary 
JavaScript and you're set.

HTH

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-english mailing list