Suggestion #6526


Added by Nils Blattner over 11 years ago. Updated almost 11 years ago.

Needs Feedback
Should have
Start date:
Due date:
% Done:


Estimated time:
Has patch:


Simple, yet essential ViewHelper if you want to print out CData content (as fluid removes the CDATA start/end tags and just prints the content).

/* * * This script is part of the TYPO3 project - inspiring people to share! * * * * TYPO3 is free software; you can redistribute it and/or modify it under * * the terms of the GNU General Public License version 2 as published by * * the Free Software Foundation. * * * * This script is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- * * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * * Public License for more details. * * */

/** * @package Fluid * @subpackage ViewHelpers * @version $Id: CropViewHelper.php 1734 2009-11-25 21:53:57Z stucki $

/** * Use this Helper if you need to print <![CDATA[ ]]. * * @version $Id:$ * @license GNU Public License, version 2 * @scope prototype
class Tx_CabagSteps_ViewHelpers_CdataViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

 * Render the CDATA content.
 * @return string CDATA comment
 * @author Nils Blattner &lt;&gt;
public function render() {
return '&lt;![CDATA[' . $this-&gt;renderChildren() . ']]>';



Updated by Tommy Seus over 11 years ago

I think it is still necessary to set a variable so that the content will not be changed.
This prevents the double quotes are converted.

protected $objectAccessorPostProcessorEnabled = FALSE;


Updated by Christian Müller about 11 years ago

  • Status changed from New to Needs Feedback

Couldn't that be done with just using the RawViewHelper? You just put the CData opener and closer into a RawViewHelper. Any content inside that shouldn't be parsed could be enclosed by RawViewHelper.


Updated by Nils Blattner about 11 years ago

Haven't actually tested it that way, but consider that the cdata tag would probably be removed if put into the body.
Might work if you use it like <x:raw raw="<![CDATA[....]]>" />, but then you cannot render stuff into it by encapsulating viewhelpers.
Which is what I needed when I was creating KML-Files (geodata xml).


Updated by Bastian Waidelich about 11 years ago

  • Tracker changed from Feature to Suggestion
  • Project changed from TYPO3.Fluid to Fluid - ViewHelper - Incubator

Updated by Bastian Waidelich about 11 years ago

  • Subject changed from CData ViewHelper to cdata

Also available in: Atom PDF