如何在Yii中CListView中按日期组项目?(How to group items by dat

2019-09-22 14:09发布

想象一下,一个CListView中呈现新闻项普通列表。 每条新闻都有,我可以通过$数据 - > insertDate访问作为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

Answer 1:

你可以试试这个http://groupgridview.demopage.ru/或本http://www.yiiframework.com/extension/xdateview/ 。 你可以创建这个两以上,好运自定义的GridView筑底。



文章来源: How to group items by date in Yii CListView?
标签: php html yii