[TYPO3-english] Typoscript: only if page has sub pages

JoH asenau info at cybercraft.de
Thu Jun 17 09:39:18 CEST 2010


>> page.100 = TEXT
>> page.100.data = field:title
>> 
>> But I need it only if the current page has children pages.
>> 
>> Is there any data field or condition that can make this work??
> 
> TEXT has stdWrap. So you can use "if". "if" has "ifTrue", which is a
> stdWrap, so it has "cObject". You can make that "cObject" as
> "RECORDS" to with "selectFields" as "COUNT(*)" and without any where
> because "pidInList" defaults to "this". So you'll get a number of
> subpages as a result. "ifTrue" will check if it is non-zero and "if"
> will let your title to be out based on that condition.

Actually it's "isTrue" - and pidInList/selectFields has nothing to do with RECORDS but with "select" which is available for CONTENT and numRows ;-)
Usually numRows has been made for counting items. In this case selectFields will be automatically set/overriden with COUNT(*)

So this should do the job

if.isTrue.numRows {
    table = pages    
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-english mailing list