0

question is: Does Yii have any method(s) to render variable with code in it?

Default:
$this->render('site/index'); where site/index is path to view file.

What I need to do is:
$content = '<div><?php echo "do something here"; ?></div>';
$this->render($content);
Output should be layout + parsed content

I tried to use $this->renderText($content); but this methods returns empty string.
I'm using Smarty extension to render view files, then $this->renderText($content); returns not parsed string: {assign ..}

Any help would be appreciated.

1 Answers1

0

There are some rendering Functions in Yii you could use to get there, but not with a variable. It would be better to use renderFile(). If you want to pass data to this file use

$this->renderFile("renderfile.php",array("var1"=>"xyz","var2"=>"abc");

More render funtions described here

Community
  • 1
  • 1
kasoft
  • 456
  • 6
  • 19