[TYPO3-core] RFC #14143: Bug: count_menuItems not working correctly

François Suter fsu-lists at cobweb.ch
Fri Aug 20 10:50:45 CEST 2010


Hi Frederic,

> Branches:
> Trunk
> Maybe interesting for TYPO3 4.4 or even 4.3

Yes for all.

> Problem:
> When rendering a menu with submenus the register count_menuItems is not
> working as expected. After rendering a submenu, the register value is
> not reset to the correct count of menu items inside the parent menu.
>
> The result is, that all following menu items of the parent menu have the
> register "count_menuItems" set to the number of menuItems of the last
> rendered submenu.
>
> Solution:
> Recalculate the count of menu items after calling the functions

Thanks for the patch. +1 after reading and testing.

For further testers, here's a sample TS that shows the issue:

lib.someMenu = HMENU
lib.someMenu {
	1 =  TMENU
	1 {
		expAll = 1
		wrap = <ul>|</ul>
		NO {
			wrapItemAndSub.cObject = TEXT
			wrapItemAndSub.cObject.value = -|
			wrapItemAndSub.cObject.noTrimWrap = |<li>({register:count_menuItems} 
- {register:count_HMENU_MENUOBJ} - {register:count_MENUOBJ}) |</li>|
			wrapItemAndSub.cObject.insertData = 1
		}
	}
	2 < .1
	2.NO.wrapItemAndSub.cObject.value = --|
	3 < .1
	3.NO.wrapItemAndSub.cObject.value = ---|
}

Add it to your site, check out the first number, apply the patch and 
re-check the first number.

Note that this brought me back to another bug I stumbled upon a while 
ago, which is that "count_MENUOBJ" is not correct either. However this 
is a different issue and I'll come up with a patch for it after this one 
has been committed.

And actually it's pretty hard to make sense of the values in 
count_HMENU_MENUOBJ...

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-team-core mailing list