[TYPO3-english] Two levels HMENU, expanding only the parent of the current page (if any)

bernd wilke t3ng at pi-phi.tk
Thu Aug 19 16:06:57 CEST 2010


Am Thu, 19 Aug 2010 13:27:49 +0000 schrieb Claudio Strizzolo:

[...]
> I need to build a two-levels vertical menu working like follows:
> 
> 1. when you are on the "people", "fruits" or "planets" page, the menu
> should show only that level. Let's imagine you are on "fruits":
> 
[...]
> 
> 2. when you are in one of the subpages, the corresponding submenu should
> be expanded while the others should remain collapsed. Let's imagine you
> are on page "banana":
> 
[...]
> 
> Up to now I have written the TS attached below, but it expands all the
> submenus.
> Any hints?

[...]

you may include a condition regarding the pagelevel to insert the 
definition of the second menu-level only if you are on this level

something like this (try your treelevel):

temp.sidemenucol = COA
temp.sidemenucol {
  10 = HMENU
  10.wrap=<div class="sidemenu">|</div>

  10.entryLevel = 0

  //this level is shown always
  10.1=TMENU
  10.1 {
     #expAll=1	// don't expand all levels on default
     noBlur=1
     wrap=<ul class="sidemenu-l1">|</ul>
     NO < sidemenu_no
     CUR < sidemenu_cur
     ACT < sidemenu_act
     ACTIFSUB < sidemenu_act
     SPC < sidemenu_spc
  }
}

// this level is shown only if you are inside this level
[treeLevel = 1]
temp.sidemenucol.10.2 = TMENU
temp.sidemenucol.10.2 {
    noBlur=1
    wrap=<ul class="sidemenu-l2">|</ul>
    NO < sidemenu_no
    CUR < sidemenu_cur
    ACT < sidemenu_act
    SPC < sidemenu_spc
    SPC.allWrap=</ul><div class="sidemenu-l2-spacer">|</div><ul 
class="sidemenu-l2">
}
[global]

- - - -

expAll = 1  will expand all sublevels of this menulevel.
otherwise only subpages of current  page are shown/expanded

the condition is neccessary only if you want no subpages shown if you are 
on the upper level (no apple,banana,strawberry when on page fruits)

if it is ok to show the current subpages you don't need the condition at 
all. just expAll = 0 (=default)


bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list