Dynamic Render in Yii
php, yii
Solution
More info: http://www.yiiframework.com/doc/api/1.1/CController#renderDynamic-detail
Cached view file:
$this->renderDynamic('dynamicTest');
Controller file (callback function):
public function dynamicTest()
{
return $this->renderPartial('dynamicTest', null, true);
}
Dynamic view file:
echo 'dynamicTest_' . time();
I think that You forgot to add return in callback function (step 2).
Problem
I have a "view" page in Yii. It is cached with page cache. Now, I want to insert some dynamic content: ``` $this->renderDynamic('renderPartial','view_name'); ``` The rendered view looks like this: ``` <?php some code ?> <div>...some html...</div> ``` The code works fine, but there is this error: <###dynamic-0###> So I understand the html is being echoed instead of returned. I try to pass the return=true to the renderPartial function. What is the right syntax to do it?