sbasuki
(Sriyono Basuki)
1
echo CHtml::link(
CHtml::image(Yii::app()->request->baseUrl.'/images/op-create.png', "image", array("width"=>30)),
Yii::app()->request->baseUrl.'/images/op-create.png',
array("class"=>"highslide", 'rel'=>'myrel'));
output :
<a class="highslide" rel="myrel" href="/web/images/op-create.png"><img width="30" src="/web/images/op-create.png" alt="image" /></a>
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'loc-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array('name'=>'loc_picture',
'type'=>'html',
'header'=>'Picture',
'value'=> 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl.$data->loc_picture, "image", array("width"=>30)), Yii::app()->request->baseUrl.$data->loc_picture, array("class"=>"highslide", \'rel\'=>\'myrel\'))',
'htmlOptions'=>array('width'=>'40','style'=>'text-align:center;'),
),
),
));
output :
<a class="highslide" href="/web/pictures/noimage.jpg"><img width="30" src="/web/pictures/noimage.jpg" alt="image" />
Why output in CGridView, REL="myrel" not shown???
Any sugestion
sbasuki
(Sriyono Basuki)
3
No change, output still same :
<a class="highslide" href="/web/pictures/noimage.jpg"><img width="30" src="/web/pictures/noimage.jpg" alt="image" />
Same problem here, tried
CHtml::link(CHtml::encode($model->image),'/uploads/'.$model->image,array("rel"=>"shadowbox")),
and even direct html
'<a href="/uploads/'.$model->image.'" rel="shadowbox">'.$model->image.'</a>',
Full code:
$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'idfotos_galeria',
'galeria_id',
array(
'type' => 'html',
'value' => CHtml::link(CHtml::encode($model->image),'/uploads/'.$model->image,array("rel"=>"shadowbox")),
//'value' => '<a href="/uploads/'.$model->image.'" rel="shadowbox">'.$model->image.'</a>',
),
),
got it. changed "type" to "raw"…
still, doesnt make ANY sense 
zaccaria
(Matteo Falsitta)
6
Are you sure that is a Yii problem?
Try to check the code, not analyzed element in firebug. I had experience of firebug not displaying the original code in some case.
sbasuki
(Sriyono Basuki)
7
thanks, this is solve my problem
change :
‘type’=>‘html’
to
‘type’=>‘raw’
MaheshML
(Maheshml007)
8
For Blog post images
<span class="post-thumb">
<?php echo CHtml::image(Yii::app()->controller->createUrl('Post/loadImage',array('id'=>$data->PostId)));?>
</span>