Ok, this is a quick one, and a bit a laziness on my part maybe…
I want to render a view in an action (nothing unusual there), but instead of rendering a particular view file, I want to give the controller a chunk of text to render.
e.g.
public function actionIndex() {
$this->render('<p>a piece of random text</p><?php echo "with some php thrown in for good ".$titbit; ?>', array('titbit' => 'measure'));
}
instead of
public function actionIndex() {
$this->render('view', array('titbit' => 'measure'));
}
I know I could just do some echoing or evaling, but I don’t really like that, and I want to preserve the same structure with Yii wrapping the resulting evaluation in the appropriate layout file.
I have dug through CController and CBaseController chasing up the various different render methods, but can’t see any easy way to do this, so does anyone have any good suggestions for this?