简体   繁体   中英

TYPO3: Using Page-Constants in HMENU / TMENU

on a Page Template, I set a constant, such as

yl.page.backgroundColor = #ff0000

Now, is there a way to access the BackgroundColor-Value of a menu item, that is rendered by TMENU? I was thinking somewhat like this:

lib.mainNavigation.1.NO.wrapItemAndSub = <li style="background-color: {$record.yl.page.backgroundColor}">|</li>

Using only {$yl.page.backgroundColor} will - of course - render the color set on the current page, not the one I set on the respective menu item...

The getText reference unfortunately does not even contain the Word "Constant".

I understand what you are trying to do, but that's not the way TypoScript works. Indeed the data from the current page is used when {$yl.page.backgroundColor}.

To achieve what you are trying to you will need to come up with a little dirt. I would suggest you store your background color in one of the unused fields of the pages (for example subtitle if you don't use this). Otherwise you can of course also add a field to the page table and use that instead.

Next step is to load your background color (set in my case in the field "subtitle") into your wrap with something like the following.

lib.mainNavigation.1.NO.wrapItemAndSub.dataWrap = <li style="background-color: {field:subtitle}">|</li>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM