Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Not Having To Use Eval With Dynamic Content

$
0
0
Hi All,

I have a site where my pages contents are stored in a database and in most of my views I just use something like
echo "$content"
.

That works fine if the data is html, but if I want to include a Yii construct like
<p>Click the following link ". CHtml::link('careers',array('jobs/list))."</p> 

it outputs it literally rather than creating the link.

The only way I've been able to output it correctly is using EVAL, something like this
eval("echo '".$content."';");
but wondering if there is a better way to do it rather than using EVAL.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>