Yii添加CDetailView上的链接无法正常工作

时间:2014-08-28 08:06:13

标签: php url yii

我正在使用zii.widgets.CDetailView

当我尝试使用target ='_ blank'添加Link时。 虽然我添加了目标空白,但这从未工作过。 该链接始终在同一个标​​签页中打开

这是我的代码:

$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")) 
    ),
),  

));

1 个答案:

答案 0 :(得分:1)

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")) 
),

更改'type'=>'html',

到'type'=>'raw',

相关问题