[TYPO3] Using count_menuItems to split a menu in two parts

Christopher Torgalson bedlamhotel at gmail.com
Tue Jan 23 21:57:16 CET 2007


Hi Eduardo,

On 1/23/07, Eduardo Trápani <eduardo at esperanto.org.uy> wrote:
> Hi,
>
> The last two menu items have to be dealt with specially and they are always there.  I wanted to create two menu objects and render them apart.  The second part will always have two items and the first part could have one or many.
>
> I tried to isolate them by using begin, maxItems and minItems but I think I'm not getting count_menuItems right.
>
> This is how the TS looks like
>
> lib.simplemenu {
>
>   10 = HMENU
>
>   10.wrap = <ul>|</ul>
>
>   10.1 = TMENU
>
>   10.1 {
>     maxItems = register:count_menuItems - 3

<snip>

The TSref is your friend. I didn't read any further than this, because
the last line of TS makes no sense--though the reason why may not be
apparent to you.

If you're going to do calculations in TS, you're going to need to use
the stdWrap property .prioriCalc [1]. But if you /check/ to see what
the TSref actually says about TMENU's 'maxItems' property, you see
that the datatype is 'int'.

This /also/ prevents you from using register:count_menuItems for
maxItems; in order to retrieve register data, a property or object
needs to have a 'getText' [3] or 'stdWrap' datatype.

What exactly are you trying to do? Why do you /need/ to count the menu
items? Tapio might be right about optionSplit being a more efficient
option, or something like this may work for you:

lib.navigation = COA
lib.navigation {
  wrap = <ul>|</ul>

  # First part of menu:
  5 = HMENU
  5 { ... }

  # Second part of menu:
  10 = HMENU
  10 { ... }
}

-- 
Christopher Torgalson


[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.0.0/view/5/1/
[2] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.0.0/view/10/1/
[3] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.0.0/view/2/2/


More information about the TYPO3-english mailing list