Assign a page content to a variable

Hi, I’m new to Yii. It is a grate framework!

Now I want to assign a page content, which is rendered by “$this->renderPartial(’_view’);”, to a variable, sth like:

$a = $this->renderPartial(’_view’); (Just to show my idea)

Anyone knows how to do this? Thanks!

One possible approach is to override the renderPartial() method to make it able to return pure HTML string.

Hope this help


According to the reference, you can do it like the following:

$a = $this->renderPartial('_view', NULL, true);


Thanks! It should work! I will try it on Monday.

It proved work! Thank you guys!