[TYPO3-english] advanced typoscript wrapping needed
Tyler Kraft
tyler.kraft at netefficiency.co.uk
Tue Apr 28 18:17:20 CEST 2009
Hi
Of course it says TEXT - wrap doesn't have any means to do what your
trying. I think what Christopher was saying was use a COA object in
total instead of wraps
temp.MainContent < styles.content.get
temp.MainContent.renderObj.stdWrap.preObject = COA{
10 = HTML
10.value = <div class="public">
10.if{...}
20 = HTML
20.value = <div class="private">
20.if{...}
30 = HTML
30.value = <div class="ctonly">
30.if{...}
}
temp.MainContent.renderObj.stdWrap.postObject = HTML
temp.MainContent.renderObj.stdWrap.postObject.value = </div>
This is untested but the idea should obviously wrap each the items
brought in using get.styles.content.
Another way to do it is adjust the stdWrap.innerWrap2 for tt_content
items so that the wraps are different and that the key it uses is
different...
There most likely are more elegant ways to do it instead of either of
these, but as far as I can see this could be done in 15minutes with
either of these methods :-)
hth
Walrick wrote:
> Christopher Torgalson wrote:
>>> But the problem with nested normal wraps combined with the if-statement
>>> is (in my experience): if the statement returns false not only is the
>>> wrap not applied but everything inside it, both further wraps and the
>>> actual content of the element, disappear as well, which leads to empty
>>> pages. Not good.
>>>
>>> The best way would have been that depending on conditions either wrap 1
>>> (public), wrap 2 (membersonly) or wrap 3 (ctonly) gets applied.
>>>
>>> A kind of If ... elseif ... else ...
>>>
>>> But the typoscript-if does not seem to have an else option.
>>
>> Just needs a little imagination.
>>
>> lib.something = COA
>> lib.something {
>> # Render only if condition 1 is true:
>> 5 = TEXT
>> 5 { ... }
>>
>> # Render only if condition 2 is true
>> 10 = TEXT
>> 10 { ... }
>>
>> # Render only if condition 3 is true:
>> 15 = TEXT
>> 15 { ... }
>> }
>>
> I've been experimenting with this. However it doesn't work yet. Problem:
> the output of the COA would have to function as a wrap.
>
> To give a simple example with a TEXT object instead of a COA:
>
> temp.MainContent < styles.content.get
> temp.MainContent.renderObj.stdWrap.cObject = TEXT
> temp.MainContent.renderObj.stdWrap.cObject.value = <div
> class="public">|</div>
>
> Produces just: "|"
>
> While:
>
> temp.MainContent < styles.content.get
> temp.MainContent.renderObj.stdWrap.wrap = TEXT
> temp.MainContent.renderObj.stdWrap.wrap.value = <div class="public">|</div>
>
> Produces just: "TEXT"
>
> So how would I go about getting the value of the TEXT object to be used
> as a wrap? If you can tell me that, then I'll probably be able to use
> the COA with conditions suggestion.
>
> The only way I know is using separate preCObject and postCObject
> properties, but then we're sort of back to unbalanced wraps.
>
> Regards,
>
> Walrick
>
More information about the TYPO3-english
mailing list