[TYPO3-english] typoscript: count_HMENU_MENUOBJ & count_menuItems

jaco graaff jaco at spacexplorer.co.za
Thu Sep 22 06:30:37 CEST 2011


I am trying to do some manipulation with conditional statements (see my post 
on multi-column menus)

If I put the code at the bottom of this post in my menu-typoscript I get a 
view of what each value means

I can test the current object number in the linear/1 dimensional array of 
menu items - in other words - independant of its level by using
{register:count_HMENU_MENUOBJ}

I can get the amount of items in a particular level by using
{register:count_menuItems}

but how do I get the current menu item within it's hierchy??

example:
------------------------------------------------------------------------------------------------------------------------


menu 1----------------------------- count_HMENU_MENUOBJ = 1, count_menuItems 
= 2
-----menu 1.1-----------------------------  cHM = 2, cmI = 4
-----menu 1.2-----------------------------  cHM = 3, cmI = 4
-----menu 1.3-----------------------------  cHM = 4, cmI = 4
-----menu 1.4-----------------------------  cHM = 5, cmI = 4
menu 2----------------------------- cHM = 6, cmI = 2
-----menu 2.1-----------------------------  cHM = 7, cmI = 3
----------menu 2.1.1------------------------------ cHM = 8, cmI = 3
----------menu 2.1.2------------------------------ cHM = 9, cmI = 3
----------menu 2.1.3------------------------------ cHM = 10, cmI = 3
-----menu 2.2-----------------------------  cHM = 11, cmI = 3
----------menu 2.2.1------------------------------ cHM = 12, cmI = 2
----------menu 2.2.2------------------------------ cHM = 13, cmI = 2
-----menu 2.3-----------------------------  cHM = 14, cmI = 3



------------------------------------------------------------------------------------------------------------------------

I need to know that [menu 2] is number 2 of a total of 2 and not number 6 of 
a total of 14

##-------------------------------------------------------------------------------------------------------------------

NO = 1
NO {
beforeWrap = b-

before.cObject = TEXT
before.cObject.field =
before.cObject.dataWrap = <span style="font-size: 9px; width:100%; 
float:left; line-height: 10px;">test registers:<br>current 
count_HMENU_MENUOBJ:{register:count_HMENU_MENUOBJ} (current position of menu 
item independant of level),<br> count_menuItems:{register:count_menuItems}
(menu items at this level),<br> count_HMENU: {register:count_HMENU} (menus 
on this page)<span>

afterWrap = -a

}

##------------------------------------------------------------------------------------------------------------------- 



More information about the TYPO3-english mailing list