Symfony render template to string
Is there a way to get fully rendered template (with or without layout) as a string, within action?
i.e. something along these lines:
public function executeMyAction()
{
$this->variable1 = 'foo';
$this->variable2 = 'bar';
// renders template using assigned variables, partials, layouts, etc. as if it was for output to browser, but assigns html to string
$renderedTemplate = $this->renderTemplateToString();
}
P.S. I am aware of this开发者_C百科 question, however the answer provided there isn't that good for my purposes. Links doesn't work and getPartial gets template file without rendering.
you should try sfController::getPresentationFor()
.
精彩评论