[TYPO3-english] advanced typoscript wrapping needed

Walrick lists at globalhealingcircle.net
Tue Apr 28 17:16:10 CEST 2009


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

-- 
webmaster Global Healing Circle
www.globalhealingcircle.net


More information about the TYPO3-english mailing list