Reputation: 317
I'm using zii.widgets.CDetailView
When I'm trying to add Link with target ='_blank'. this never working although I'm added the target blank. The link always open in the same tab
here's my code:
$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'htmlOptions'=>array('class'=>'table table-condensed table-hover'),
'attributes'=>array(
'idproduct',
array(
'name'=>'Preview',
'type'=>'html',
'value'=>(
(!empty($model->picture->filename_thumb))?
CHtml::image(Yii::app()->baseUrl . "/images/product/".$model->picture->filename_thumb,"Preview",array("width"=>"75px","height"=>"75px")):"No Image"
),
),
array(
'name'=>'Company',
'type'=>'html',
'value'=>$model->company->name,
),
array(
'name'=>'Product URL',
'type'=>'html',
'value'=>CHtml::link(CHtml::encode('Click Here'), "http://localhost/voucher/".$model->urlproduct, array("class"=>"btn btn-info","target"=>"_blank"))
),
),
));
Upvotes: 0
Views: 479
Reputation: 476
array(
'name'=>'Product URL',
'type'=>'html',
'value'=>CHtml::link(CHtml::encode('Click Here'), "http://localhost/voucher/".$model->urlproduct, array("class"=>"btn btn-info","target"=>"_blank"))
),
change the 'type'=>'html',
to 'type'=>'raw',
Upvotes: 1