Php Cgridview-Yii框架中动态列的Chtml链接
我正在尝试使用输入日期(列从_dt到_date动态开始)呈现带有动态列的Cgridview 现在我想为动态列提供Chtml::link,但我得到了错误Php Cgridview-Yii框架中动态列的Chtml链接,php,yii,cgridview,yii-chtml,Php,Yii,Cgridview,Yii Chtml,我正在尝试使用输入日期(列从_dt到_date动态开始)呈现带有动态列的Cgridview 现在我想为动态列提供Chtml::link,但我得到了错误未定义的索引:“01”(动态列)。 $columns=array(数组('name'=>'Agents','header'=>'Agents', 'htmlOptions'=>array('style'=>width:300px'), 数组('name'=>'category','cssClassExpression'=>'$data[“categ
未定义的索引:“01”(动态列)。
$columns=array(数组('name'=>'Agents','header'=>'Agents',
'htmlOptions'=>array('style'=>width:300px'),
数组('name'=>'category','cssClassExpression'=>'$data[“category”]==“Total”?“Total”:($data[“postcode”]!=“?”Sub):$data[“category”],'header'=>'category','htmlOptions'=>数组('style'=>'宽度:300px;'),
数组('name'=>'postcode','header'=>'postcode','htmlOptions'=>数组('style'=>'width:350px')),
数组('name'=>'TotalPeriod','header'=>'TotalPeriod'),
数组('name'=>'percent','header'=>'%','htmlOptions'=>数组('style'=>'width:350px')),
);
//动态列呈现代码
对于($i=0;$i<$numberDays;$i++)
{
如果($i!=0)
$start=date('d-m-Y',strottime(+1天),strottime($start));
$timestamp=strottime($start);
$columns[]=array('name'=>date(“d”),$timestamp),'header'=>date(“d”,$timestamp),'value'=>CHtml::link($data[date(“d”),'.$timestamp.)),”http://www.google.com,数组(“目标”=>“_blank”),“类型”=>“原始”,);
}
请检查以下工作代码
for($i=0;$i < $numberDays ; $i++)
{
if ($i != 0)
$start = date('Y-m-d', strtotime("+1 day", strtotime($start)));
$timestamp = strtotime($start);
$day = date("d", $timestamp);
$columns[] = array('name'=>date("d", $timestamp), 'header'=>date("d", $timestamp), 'value' =>'getVal($data,"'.$day.'") > 0 ? CHtml::link(getVal($data,"'.$day.'")," ",array("class"=>"drillDay","id"=>"'.$start.'")) : getVal($data,"'.$day.'")', 'type' => 'raw');
//$columns[] = date("d", $timestamp);
//$datatemp[$start] = $start;
}
($i=0;$i<$numberDays;$i++)的
{
如果($i!=0)
$start=date('Y-m-d',strottime(+1天),strottime($start));
$timestamp=strottime($start);
$day=日期(“d”,时间戳为$timestamp);
$columns[]=array('name'=>date(“d”),$timestamp),'header'=>date(“d”,$timestamp),'value'=>getVal($data,“$day.”)”)>0?CHtml::link(getVal($data,“$day.”,“$day.”),array(“class”=>“drillDay”,“id”=>“$start.”):getVal($data,“$day.”,“,”键入“=>raw”);
//$columns[]=日期(“d”,时间戳为$timestamp);
//$datatemp[$start]=$start;
}
for($i=0;$i < $numberDays ; $i++)
{
if ($i != 0)
$start = date('Y-m-d', strtotime("+1 day", strtotime($start)));
$timestamp = strtotime($start);
$day = date("d", $timestamp);
$columns[] = array('name'=>date("d", $timestamp), 'header'=>date("d", $timestamp), 'value' =>'getVal($data,"'.$day.'") > 0 ? CHtml::link(getVal($data,"'.$day.'")," ",array("class"=>"drillDay","id"=>"'.$start.'")) : getVal($data,"'.$day.'")', 'type' => 'raw');
//$columns[] = date("d", $timestamp);
//$datatemp[$start] = $start;
}