[TYPO3] Split menu with variable number of items in half

Jan Slusarczyk janslu at grupaiis.pl
Mon Mar 27 23:10:10 CEST 2006


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