[TYPO3] HMENU/TMENU: 2 levels in 1 menu?
Peter Klein
peter at umloud.dk
Mon Dec 4 10:45:23 CET 2006
Hi Pieter. that's a bit tricky, since the "wrap" property doesn't have
"stdWrap" support, so you can't use COA's there. But try this:
-- cut --
lib.xyzmenu = COA
lib.xyzmenu {
10 = HMENU
10.1 = TMENU
10.1 {
expAll = 1
wrap = <ul>|</ul>
NO {
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.field = title
20 = LOAD_REGISTER
20.firstPos = 1
}
wrapItemAndSub = <li>|</li>
}
}
10.2 = TMENU
10.2 {
expAll = 1
wrap = <ul>|</ul>
NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
10 = COA
10 {
10 = TEXT
10.data = DB : pages:{field:pid}:title
10.insertData = 1
10.typolink.parameter.field = pid
10.wrap = |</li><li>
20 = LOAD_REGISTER
20.firstPos = 0
if.isTrue.data = register:firstPos
}
20 = COA
20 {
10 = TEXT
10.field = title
10.typolink.parameter.field = uid
}
}
wrapItemAndSub = <li>|</li>
}
}
}
page.10 < lib.xyzmenu
-- cut --
It uses the "LOAD_REGISTER" Object to check if it's the 1st menu item on a
submenu.
If it is the 1st item, then it adds a new item BEFORE the 1st item,
containing the title (with link) of the parent page.
--
Peter Klein/Umloud Untd
> The code above will wrap around each item in the menu. I would like to
> add 1 line on top of the menu.
> But, I'm getting close now. This is what I got:
> -- cut --
> temp.mainmenu.20.2 = TMENU
> temp.mainmenu.20.2 {
> expAll = 1
> wrap = <UL class=level1> TEST | </UL>
> NO.wrapItemAndSub = <LI> | </LI>
> }
> -- cut--
>
> This shows the word TEST on top of the menu. But instead of this fixed
> word TEST, I would like it to be something like:
> 10 = TEXT
> 10.data = leveltitle:-2
> 10.typolink.parameter.data = leveluid:-2
>
> Now, I can't think of a way to get this done with the wrap for the
> moment...
>
> I also experimented with .before:
> -- cut--
> temp.mainmenu.20.2 = TMENU
> temp.mainmenu.20.2 {
> NO.before.data = page:title
> }
> -- cut--
>
> This puts the name of the page title before each element in the menu, not
> once on top of the menu. .before does not seem to work for the entire
> submenu.
>
> Regards,
> Pieter
More information about the TYPO3-english
mailing list