[TYPO3-english] Flexible menu starting points

JoH asenau info at cybercraft.de
Thu Jul 24 18:17:59 CEST 2014


>> In this case a fully TS based version would need a rootline menu to get
>> the uid of that particular page, but a userFunc might be the better
>> choice regarding performance.
>>
>> lib.menu = COA
>> lib.menu {
>>    10 = HMENU
>>    10 {
>>      special = rootline
>>      special.range = 0|-1
>>      1 = TMENU
>>      1.NO {
>>        doNotLinkIt = 1
>>        stdWrap.cObject = LOAD_REGISTER
>>        stdWrap.cObject {
>>          mystartingpoint.field = uid
>>          mystartingpoint.if.isTrue.field = menuroot
>>        }
>>      }
>>    }
>>    20 = HMENU
>>    20 {
>>      special = directory
>>      special.value.data = register:mystartingpoint
>>      ... more menu stuff here
>>    }
>> }
>
> When i'm on the page that has checkbox set (value=1) all is fine -
> mystartingpoint value is set to pageID, BUT when i'm on the page that
> has checkbox unchecked (value=0) there is nothing in variable
> mystartingpoint. Any hints? Going nuts after trying various things :-( Thx.

Did you try setting the COA to COA_INT?
This would disable the caching and make sure that there is no issue with it.

Actually the purpose of the first menu is, to walk up the rootline from 
the root to the current page and always write the uid to the register, 
when the checkbox is set. So the uid of last page with an activated 
checkbox should be registered in the end.

You could replace the if with fieldRequired, but actually this should 
not make a difference.

stdWrap.cObject = LOAD_REGISTER
stdWrap.cObject {
   mystartingpoint.field = uid
   mystartingpoint.fieldRequired = menuroot
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-english mailing list