CHtml::link target属性




<?php $this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'userinfo-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

          array('name'=>'photo',

            'value'=>'CHtml::link("查看照片", array("userinfo/lookphoto","id"=>$data->id),array("target"=>"_blank","class"=>"test"))',

            'type'=>'html',

            'htmlOptions'=>array('style'=>'width:60px;'),

          ),

	),

)); ?>




如此,但是CHtml::link 第三个参数target="_blank",这个没效果,查看源代码,发现这个属性没加上。。。class="test" 就有~~~

之前我搜站内的帖子

http://www.yiiframework.com/forum/index.php?/topic/6770-open-new-window-using-chtmllink/page__p__34581__hl__chtml+link#entry34581

有说是能的,为什么我的不行呢

怎木回事~!!!!

这个怎么改是好。。。

没问题啊!

我看了源码,确实把那部分给加上了!

你自己去调试以下吧

http://code.google.com/p/yii/source/browse/tags/1.1.7/framework/web/helpers/CHtml.php#2074

这个位置

可能是你的版本不同吧!




	public static function tag($tag,$htmlOptions=array(),$content=false,$closeTag=true)

	{


	}




	public static function renderAttributes($htmlOptions)

	{


	}



看了,2函数代码一样,剩下的就是版本问题了?

framework/yii.php




/**

 * Yii bootstrap file.

 *

 * @author Qiang Xue <qiang.xue@gmail.com>

 * @link http://www.yiiframework.com/

 * @copyright Copyright &copy; 2008-2010 Yii Software LLC

 * @license http://www.yiiframework.com/license/

 * @version $Id: yii.php 1678 2010-01-07 21:02:00Z qiang.xue $

 * @package system

 * @since 1.0

 */