I tried to render php code from database,
I used renderText, eval, but didn’t help
This is the code that I saved into database.
<h1><?php echo Yii::t('its','TEST HEADER');?></h1>
Any idea how to overcome this issue
Thanks
I tried to render php code from database,
I used renderText, eval, but didn’t help
This is the code that I saved into database.
<h1><?php echo Yii::t('its','TEST HEADER');?></h1>
Any idea how to overcome this issue
Thanks
eval()
won’t work in this case, as described at http://php.net/manual/en/function.eval.php
So, you would need to have something like:
$code = "?><h1><?php echo 'Hello there'; ?></h1>";
eval($code);
The important thing to notice is the closing PHP tag before the first <h1> tag.
it works thanks mate