[TYPO3-english] TMENU IFSUBSUB - Special action if menu-item has Sub-Sub Pages

Christopher Torgalson bedlamhotel at gmail.com
Thu Jan 28 18:34:18 CET 2010


Hi,

On Thu, Jan 28, 2010 at 9:00 AM, Ansgar Brauner <ansgarb at gmail.com> wrote:
> Tapio Markula schrieb:
>>> Hi,
>>>
>>> 1. the menu item in the 2nd Level looks different if there is a 3rd
>>> level.
>>> 2. The Menu is based on css and lists. Its always expanded. CSS is doing
>>> the trick of expanding it on mouseover.
>>
>>
>> see
>> USERDEF1
>> in
>> http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/10/#id4447861
>>
>>
>> you must build the functionality yourself - create a loop and check
>> 'pid' values of pages, if the page has several level ancestor pages.
>
> What a pity!
>
> I thought it would maybe possible through LOAD_REGISTER.
> Something this way Pseudocode alarm!):
>
> HMENU
>  TMENU
>  1.NO.wrapItemAndSub = <li class="alwaysUsed {register:thirdLevel}
>
>  ...
>
>  3.NO {
>    LOAD_REGISTER
>      register:thirdLevel = thirdTrue
>  }
>
>
> But thanks for your help


Tapio's offer is one way, but I think there's a way that's slightly
simpler–though it involves writing a php script that does what he
describes. Since what you need to do is essentially place a class in
the top-level menu items according to whether or not they have 'n'
sub-levels, you can do something like this:

includeLibs.menuLevels = path/to/menuLevels.php

1 = TMENU
1 {
  wrap = <ul>|</ul>
  wrapItemAndSub = |</li>
  allWrap.prepend = USER
  allWrap.prepend {
    userFunc = user_menuLevels
    pid = field:uid
  }
}

Your userFunc will need to take the value of pid and find out how many
levels there are under this particular menu item, and pid will have to
be processed for stdWrap in order for 'field:uid' to work–but the two
things together are not too big a job.

It should also be possible to do this–I think the method would be
essentially the same–with Typoscript's CONTENT cObject but I think
it'd be more difficult (this is a kind of magic spell that usually
causes a TS guru to enter the conversation with a two-line
solution...)

-- 
Christopher Torgalson
http://www.typo3apprentice.com/


More information about the TYPO3-english mailing list