[TYPO3] Split menu with variable number of items in half
Peter Klein
peter at umloud.dk
Tue Mar 28 09:48:49 CEST 2006
Hi Jan. That's because the value of "register:count_HMENU_MENUOBJ" doesn't
get reset for every menu, but rather gets increased for each menuitem
displayed on the page.
So my guess is that you have some other menu on your page, BEFORE this one
(Maybe a language menu?)
Here's an updated version of the code I posted yesterday, which should work
no matter if theres other menus before it on the page.
--- cut ---
lib.splitmenu = COA
lib.splitmenu {
10 = LOAD_REGISTER
10.count_menuItemsOffset.data = register:count_HMENU_MENUOBJ
20 = HMENU
20.special = directory
20.special.value = 18
20.1 = TMENU
20.1 {
wrap = <div>1st half of menu items<br>|</div>
NO {
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.field = title
10.data =
if.value.data = register:count_HMENU_MENUOBJ
if.isGreaterThan.prioriCalc=intval
if.isGreaterThan.cObject=TEXT
if.isGreaterThan.cObject.insertData=1
if.isGreaterThan.cObject.value =
({register:count_menuItems}+{register:count_menuItemsOffset})/2
wrap = |<br>
}
}
}
30 < .20
30.1.wrap = <div>2nd half of menu items<br>|</div>
30.1.NO.stdWrap.cObject.if.negate = 1
}
page.200 < lib.splitmenu
--- cut ---
Let me know if it works..
--
Peter Klein/Umloud Untd
"Jan Slusarczyk" <janslu at grupaiis.pl> skrev i en meddelelse
news:mailman.1.1143499461.2228.typo3-english at lists.netfielders.de...
>> Hi Jan. Try this:
>> cut...
>
> Thank you Peter!
> It's almost perfect! There's a rounding problem
> with 4 pages - there was 1 | 2 3 4 split,
> with 5 pages - 1 2 | 3 4 5
>
> I've changed the condition to:
> if.isGreaterThan.cObject.value = {register:count_menuItems}/2 + 2
>
> and I have:
> with 4 pages: 1 2 3 | 4
> with 5 pages 1 2 3 | 4 5
>
> But this is so minor, that I can happily live with it.
>
> Thank you so much
> Jan
More information about the TYPO3-english
mailing list