Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Yii CListView中按日期对项目进行分组?_Php_Html_Yii - Fatal编程技术网

Php 如何在Yii CListView中按日期对项目进行分组?

Php 如何在Yii CListView中按日期对项目进行分组?,php,html,yii,Php,Html,Yii,想象一下,一个由CListView呈现的简单新闻项列表。每个新闻项都有一个“insertDate”属性,我可以通过$data->insertDate访问该属性。现在,这样的列表将如下所示: // example (how list is displayed now) 9-18-2012 - Stocks fell for 2nd week 9-18-2012 - Record heat for 2012 9-18-2012 - Crime down in the state 9-17-2012

想象一下,一个由CListView呈现的简单新闻项列表。每个新闻项都有一个“insertDate”属性,我可以通过$data->insertDate访问该属性。现在,这样的列表将如下所示:

// example (how list is displayed now)
9-18-2012 - Stocks fell for 2nd week
9-18-2012 - Record heat for 2012
9-18-2012 - Crime down in the state
9-17-2012 - Stock woes are worrying investors
9-17-2012 - Business outlook is optimistic despite slow growth
9-16-2012 - More people moving into big cities
9-16-2012 - Stay ahead of the flu this year
我想做的是在该天内的所有项目上方显示一个日期标题,这样显示看起来更像这样(如下)。有没有办法调整CListView来做到这一点

// example of what i want to do
=======News for 9/18======
Stocks fell for 2nd week
Record heat for 2012
Crime down in the state

=======News for 9/17======
Stock woes are worrying investors
Business outlook is optimistic despite slow growth

=======News for 9/16======
More people moving into big cities
Stay ahead of the flu this year

你可以试试这个或这个。goodluck,您可以基于上面两个创建自定义gridview。

首先,我认为这是一个扩展