[TYPO3-english] Typoscript stdWrap if COA element not empty
bernd wilke
t3ng at bernd-wilke.net
Tue Jun 30 07:58:22 CEST 2015
Am 30.06.15 um 06:59 schrieb Arun Chandran:
> Hi Guys,
>
> I've a typoscript configuration to build a small HTML structure. Starting
> of the HTML tag is in a plugin template and closing in typoscript. I mean;
>
> lib.contactbox = COA
> lib.contactbox {
> 10 < plugin.tx_myext_pi1
>
> 20 < styles.content.get
> 20.select.where = colPos = 3
>
> wrap = |</div>
> }
>
> Here my extension start an HTML tag and closing is in typoscript. It works
> fine.
no. it does not work fine. otherwise you would not have this problem.
> But my problem is, if there is no content from plugin, then the close div
> tag is working which breaks HTML. So my requirement is only the wrap of
> closing div works when there is any content from plugin.
>
> I've tried the following script but not working;
>
> lib.contactbox = COA
> lib.contactbox {
> stdWrap.wrap = |</div>
> stdWrap.required = 1
>
> 10 < plugin.tx_myext_pi1
>
> 20 < styles.content.get
> 20.select.where = colPos = 3
> }
>
> If anybody knows the solution, then please help;
you can build a very complicated structure to test whether your plugin
returns empty (copy the plugin inside your typoscript or store the value
in a register for two reads) but the easiest way is: close the div where
the information about emptyness is orinated: inside the plugin.
I always use a variable for the return value of a function and try to
have only one exit at the end. In that way I can test for empty just
before returning and can append a closing div if not empty.
in general I would avoid having opening and ending tags at different
places.
TYPO3 uses 'wraps', which means: something before and something after
and that is exact the structure of HTML: .wrap = opentag|closetag
Also this wraps (can) occur only if content is available avoiding empty
wraps: .required = 1
bernd
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-english
mailing list