我可以在详细信息视图中显示图像,但无法在Yii主题中显示图像。我想在img标签中添加width和alt标签。是否可以?
我写如下:
$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'htmlOptions'=>array('class'=>'table table-striped responsive-table'),
'attributes'=>array(
'id',
'code',
'name',
'description',
array(
'type'=>'raw',
'width'=>'200',
'alt'=>'hi images',
'value'=> CHtml::image(Yii::app()->request->baseUrl.'/images/products/'.$model->image),
),
'price',
),
));
您可以按照此处的说明添加各种html选项。
公共静态字符串图像(字符串$ src,字符串$ alt ='',数组$ htmlOptions = array())
所以就像
CHtml::image(
Yii::app()->request->baseUrl . '/images/products/' . $model->image ,
'some thing here' , array(
'style' => 'width = 200px; height: 100px',
));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句