[TYPO3-dev] Avoid rendering menu based on number of items

John Angel johnange at gmail.com
Tue Jan 20 08:22:30 CET 2009


Hi,

How to avoid rendering of some TS script based on result of PHP function?

In the code bellow, the process is similar to this:

1. {count menu items}
2. {build menu - calling typoLink for every single page}
3. {check is number of menu items is larger than 1 and smaller than 5} => display menu or not

**********
submenu = HMENU
submenu {
        entryLevel = 1

        1 = TMENU
        1.NO.allWrap = |

        stdWrap.if {
                        value.data = register:count_menuItems
                        isLessThan = 1
                        isGreaterThan = 5
        }
}
**********

I want to change the process to:

1. {count menu items}
2. {check is number of menu items is larger than 1 and smaller than 5} => next step or exit
3. {build menu - calling typoLink for every single page}

Is this the right way to do:

**********
includeLibs.something = EXT:test/pi1/class.tx_test.php
#entryLevel, minCount, maxCount
[userFunc = tx_test->user_countMenuItems(1,1,5)]
submenu = HMENU
submenu {
        entryLevel = 1

        1 = TMENU
        1.NO.allWrap = |
}
[end]
**********

Regards,
John






More information about the TYPO3-dev mailing list