[TYPO3-english] Typoscript stdWrap if COA element not empty
Jo Hasenau
info at cybercraft.de
Thu Jul 2 22:23:52 CEST 2015
> But if you really really really reeeeally can't do that, here is a
> possible solution (untested):
>
> --
> lib.contactbox = COA
> lib.contactbox {
> 10 < plugin.tx_myext_pi1
>
> # If empty, load a register and add a variable into it
> 10.stdWrap.ifEmpty.cObject = LOAD_REGISTER
> 10.stdWrap.ifEmpty.cObject.tx_myext_pi1_isEmpty = 1
>
> 20 < styles.content.get
> 20.select.where = colPos = 3
>
> # Only use wrap if register variable is not set
> stdWrap.wrap = |</div>
> stdWrap.wrap.if.isNull.data = register:tx_myext_pi1_isEmpty
>
> # Restore register to before last LOAD_REGISTER use
> 99 = RESTORE_REGISTER
> }
>
> --
This won't work, since the RESTORE_REGISTER will always be triggered,
even if there was no LOAD_REGISTER at all - so it might break other
register values.
Try this one instead
lib.contactbox = COA
lib.contactbox {
10 = LOAD_REGISTER
10.myPlugin.cObject < plugin.tx_myext_pi1
20 = TEXT
20.data = register:myPlugin
30 < styles.content.get
30.select.where = colPos = 3
40 = TEXT
40.value = </div>
40..if.isTrue.data = register:myPlugin
50 = RESTORE_REGISTER
}
or without registers but "current" instead
(not tested but should be working according to TSref)
lib.contactbox = COA
lib.contactbox {
10 = TEXT
10.setCurrent.cObject < plugin.tx_myext_pi1
10.current = 1
20 < styles.content.get
20.select.where = colPos = 3
30 = TEXT
30.value = </div>
30.if.isTrue.current = 1
}
Done :-)
HTH
Joey
--
Diversity:
Die Kunst zusammen unabhängig zu denken
The art of thinking independently together.
--
Facebook: https://www.facebook.com/johasenau
Twitter: http://twitter.com/bunnyfield
Xing: http://contact.cybercraft.de
TYPO3 cookbook (2nd edition): http://www.typo3experts.com
More information about the TYPO3-english
mailing list