Suggestion #6526
cdata
Status: | Needs Feedback | Start date: | 2010-02-19 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | - | |||
Target version: | - | |||
Has patch: | Tags: |
Description
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 http://opensource.org/licenses/gpl-license.php 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 <nb@cabag.ch>
*/
public function render() {
return '<![CDATA[' . $this->renderChildren() . ']]>';
}
}
?>
History
#1 Updated by Tommy Seus over 5 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;
#2 Updated by Christian Müller about 5 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.
#3 Updated by Nils Blattner about 5 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).
#4 Updated by Bastian Waidelich about 5 years ago
- Tracker changed from Feature to Suggestion
- Project changed from TYPO3.Fluid to Fluid - ViewHelper - Incubator
#5 Updated by Bastian Waidelich about 5 years ago
- Subject changed from CData ViewHelper to cdata