[TYPO3-templavoila] How to test an empty container / section with TypoScript?
leeperry at slack.de
Mon Sep 3 18:00:26 CEST 2007
Olivier Schopfer schrieb:
> 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:
> <field_left_seealso_all type="array">
> <tx_templavoila type="array">
> <title>See also all wrap</title>
> <sample_data type="array">
> <numIndex index="0">Display see also section</numIndex>
> 10 = TEXT
> 10.dataWrap = display:none;
> 10.if.isFalse.data = register:see_also_count
> <TCEforms type="array">
> <label>Display see also section</label>
> Hope this will help others...
what happens, if you are using your FCE or page more than one time? The
register see_also_count could be set by the other instance of the FCE -
so you have to clear it first at the beginning of your FCE, or haven't you?
I've had a similar problem by building a FCE for a table with
alternating background-colors for the table rows (each table row is a
section of the FCE) - see newsgroup-message "[TYPO3-templavoila] Section
Without the clearing of the register variable my tables have started
with the next color of the last using tabel row color of the previous FCE.
And for you it would mean, that for the second FCE the register
"see_also_count" is not false!
Or have I misunderstood your problem/solution?
More information about the TYPO3-project-templavoila