[TYPO3-templavoila] How to test an empty container / section with TypoScript?
ops at wcc-coe.org
Mon Sep 3 15:45:40 CEST 2007
Dmitry Dulepov [typo3] wrote:
> Olivier Schopfer wrote:
>> Does anybody know a way to test if a section contains sub-items or not?
> No, there is no way.
>> I want to be able to hide the following list of links in case it's
>> empty. I suppose that one could achieve that with a .if TypoScript
>> condition. But how to access the subfields? And how to change the
>> overall wrap of the section (I've tried to put some Typoscript at the
>> level of the container, but it doesn't seem to work).
> Bug report for it exists but not solved yet. It is difficult to solve
> because requires passing a lot of information to recursive functions.
Hi again. Quite proud to say that I found a nice workaround, using a
In one of the typoScript based sub-elements, I added section 20:
10 = TEXT
10.typolink.parameter.current = 1
10.typolink.returnLast = url
20 = LOAD_REGISTER
20.see_also_count.cObject = TEXT
20.see_also_count.cObject.data = register:see_also_count
20.see_also_count.cObject.wrap = |+1
20.see_also_count.prioriCalc = intval
This counts the sub-items and stores the result in the register called
And then, I created a new field, which is mapped as an attribute of the
style parameter of the <div> section containing the list:
<title>See also all wrap</title>
<numIndex index="0">Display see also section</numIndex>
10 = TEXT
10.dataWrap = display:none;
10.if.isFalse.data = register:see_also_count
<label>Display see also section</label>
Hope this will help others...
More information about the TYPO3-project-templavoila