[TYPO3] Split menu with variable number of items in half
Peter Klein
peter at umloud.dk
Mon Mar 27 23:46:49 CEST 2006
Hi Jan. Try this:
--- cut --
lib.splitmenu = COA
lib.splitmenu {
10 = HMENU
10.special = directory
10.special.value = 1
10.1 = TMENU
10.1 {
wrap = <div>1st hall of menu items<br>|</div>
NO {
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.field = title
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}/2
wrap = |<br>
}
}
}
20 < .10
20.1.wrap = <div>2nd hall of menu items<br>|</div>
20.1.NO.stdWrap.cObject.if.negate = 1
}
page.2 < lib.splitmenu
-- cut --
---
Peter Klein / Umloud Untd.
"Jan Slusarczyk" <janslu at grupaiis.pl> wrote in message
news:mailman.1.1143493811.14867.typo3-english at lists.netfielders.de...
> I've spent the previous 5 hours trying to get the menu I need to work, but
> with no luck. To cut the story short I need to have a TMENU split in half
> like this:
>
> <div class="leftMenu">
> <ul>
> <li>item #1</li>
> <li>item #2</li>
> ...
> <li>item #n/2</li>
> </ul>
> </div>
> <div class="rightMenu">
> <ul>
> <li>item #n/2+1</li>
> ...
> <li>item #n</li>
> </ul>
> </div>
>
> n - is variable and can be anywhere between 1 and 35 (at the moment).
>
> At the moment I am using the beautiful code I got from typo3wizard.com. It
> is very close to what I am trying to achieve, but it results in a pattern:
>
> 1 2
> 3 4
> 5 6
> ...
>
>
> whereis I need
>
> 1 4
> 2 5
> 3 6
> ...
>
> here's the code:
>
>
> ######
> # Linki
> ######
>
> temp.linkiLewe = HMENU
> temp.linkiLewe.special = directory
> temp.linkiLewe.1 = TMENU
> temp.linkiLewe.1.noBlur = 1
> temp.linkiLewe.1.NO{
> allWrap=<li class="linki">|</li>
> stdWrap.if.isFalse.prioriCalc=1
> stdWrap.if.isFalse.cObject=TEXT
> stdWrap.if.isFalse.cObject.insertData=1
> stdWrap.if.isFalse.cObject.value={register:count_HMENU_MENUOBJ}%2
>
> allWrap.if.isFalse.prioriCalc=1
> allWrap.if.isFalse.cObject=TEXT
> allWrap.if.isFalse.cObject.insertData=1
> allWrap.if.isFalse.cObject.value={register:count_HMENU_MENUOBJ}%2
> }
>
> temp.linkiPrawe = HMENU
> temp.linkiPrawe.special=directory
> temp.linkiPrawe.1 = TMENU
> temp.linkiPrawe.1.noBlur=1
> temp.linkiPrawe.1.NO{
> allWrap=<li class="linki">|</li>
> stdWrap.if.isTrue.prioriCalc=1
> stdWrap.if.isTrue.cObject=TEXT
> stdWrap.if.isTrue.cObject.insertData=1
> stdWrap.if.isTrue.cObject.value={register:count_HMENU_MENUOBJ}%2
> allWrap.if.isTrue.prioriCalc=1
> allWrap.if.isTrue.cObject=TEXT
> allWrap.if.isTrue.cObject.insertData=1
> allWrap.if.isTrue.cObject.value={register:count_HMENU_MENUOBJ}%2
> }
>
> and then COA to glue these two together...
>
> I think I should be using the following condition:
>
> stdWrap.if.value.data=register:count_menuItems/2
> stdWrap.if.lessThan.data=register:count_HMENU_MENUOBJ
>
> But I don't know how to get it to work... Maybe there's a better, simpler
> way? Because of the variable number of items I can't use maxObjects which
> would be the easiest way. Or maybe there's a way to insert a variable here
> (tsRef states that I need an int value)???
>
> Any help will be very appreciated...
>
> Cheers
> Jan
More information about the TYPO3-english
mailing list