[TYPO3-english] Custom wrapping text and textpic cObj
plankmeister_NO at SPAM_hotmail.com
Mon Nov 23 11:58:35 CET 2009
Chris Müller wrote:
> Hi Andrew,
> why don't you use a "normal" wrap:
> tt_content.text.wrap = FRED1|FRED2
I need to add a trailing </div> in very specific situations, relating to
an extension I've created. It's a header-style extension that creates an
accordion out of content elements, using the header as the accordion
toggle, and the bodytext of the content element as the content of the
accordion. Initially, I needed to add two HTML content elements to the
page, one above and one below the content elements, the upper one
and the bottom one containing:
...so that the accordions can be targetted properly by the JS.
Then I modified the extension so that the first content element on the
page that has this scpecific header_layout property, has the HTML
prepended to it. This works exactly as expected.
However, to add a </div> to the end, I'm targetting the last content
element on the page, and simply adding "</div>" to the bodytext property
of the cObj. This *sort of* works. It adds the </div>, but because this
is happening before the content is rendered, then the </div> is
automatically wrapped by <p>|</p> by the rendering process, so it ends
...which of course isn't valid XHTML.
So I need to wrap it from "outside" the scope of the plugin, yet still
be able to check if the currently processed content element is the last
one on the page, and if so, wrap it with |</div>
It's complicated, but if I can get it to call a function, I can get it
to work, which then makes the plugin far more usable. It's too much
hassle to have to get users to remember to add in arbitrary HTML content
elements to get it to work.
Sorry for the long explanation, but you did ask :)
More information about the TYPO3-english