E
E
EVOSandru62015-03-11 14:34:55
Yii
EVOSandru6, 2015-03-11 14:34:55

How to process tags and img in Yii in CDetailView?

Good afternoon!
There is this piece of code:

$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
         'DESCRIPTION',
        'PHOTO'=>array(
            'name'=>'PHOTO',
            // по данному адресу у меня лежат картинки и в обычных представлениях они отображаются
            'value'=>Yii::app()->baseUrl.'/images/forum/'.$model->CODE.'/'.$model->photo->NAME,
        )
),
));

At the output I get a raw DESCRIPTION :
<p>
 Фооооооооооооооооорууууууууууууууууууууууууууууууууум !!!!!!!!!!!! &nbsp;</p>

And a piece from the address of the picture ... By the way, now I just realized what needs to be CHtml::imagedone through. By the way - can you tell me how to correctly enter this tag into the image attribute?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Kolokolnikov, 2015-03-12
@EVOSandru6

Set the type property. For html - html, for image - image. To display value as is - raw.

M
Maxim Grechushnikov, 2015-03-11
@maxyc_webber

'value'=>CHtml::image(Yii::app()->baseUrl.'/images/forum/'.$model->CODE.'/'.$model->photo->NAME), ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question