开发者

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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜