Disabling output escaping in module or action
Every now and then i get frustrated because all data in my view template is escaped by on of the symfony escaper decorator objects (sfOutputEscaperObjectDecorator, sfOutputEscaperArrayDecorator) I didn’t find a handy method to disable this. So the solution below is what works for me.
The way to disable this per module or action is to simple set the configuration value for output escaping to false, either in the preExecute method or in a specific action, like this:
public function executeEscapingtest(sfWebRequest $request)
{
sfConfig::set('sf_escaping_strategy', false);
[...]
}
All variables will be available unescaped in your view. Of course you should be careful with this options, since output escaping your user submitted content is still a very wise thing to do, obviously.
For more information see the escaping strategy options in the symfony reference.
Edit by JM:
Two additional ways to achieve this:
// the escaped output
echo $output;
// disable escaping
echo $sf_data->getRaw('output');
// disable escaping from class method output
echo $object->getSomething(ESC_RAW);