I Can't Render Html Properly

Hi everyone, I’m trying to render some contents of my database, and them contains html tags, the problem is that when I render the page, I see the html tags instead of a right render.

Things like <b>…</b>

I looked for it, and found "solutions" like :

echo CHtml::decode($model->attribute); 

But it doesn’t work for my… any suggestions?


Was your html saved in the db after being encoded with CHtml::encode() within Yii, or was it already encoded?

If it was encoded outside of Yii or using some other method, you may need to use htmlspecialchars_decode

Look at the flags that can be set.

finally it works but I have another problem because I need to decode this also in widgets that I use like

‘zii.widgets.CDetailView’ or ‘zii.widgets.grid.CGridView’ I use these in the detailview and gridview but there I don’t have any similar to :

echo CHtml::

I was looking for any clues and I found that there is an option like “type”=>“html”, y tried it in the field that I want to render properly html code but it didn’t work:

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(














)); ?>

Does anyone know any about this?

Thanks again!


I’ve just found the solution