kinglozzer/silverstripe-columnedlist
最新稳定版本:2.1.0
Composer 安装命令:
composer require kinglozzer/silverstripe-columnedlist
包简介
An SS_ListDecorator to facilitate stacking data vertically in columns
README 文档
README
An SS_ListDecorator to facilitate stacking data vertically in columns. Supports left and right “weighting”.
Example:
use Kinglozzer\SilverStripeColumnedList\ColumnedList; use SilverStripe\CMS\Model\SiteTree; class Page extends SiteTree { public function ColumnData() { return ColumnedList::create($this->SomeDataList()); } }
<% loop ColumnData.Stacked(3) %> <div style="float: left"> <h3>Column {$Pos}</h3> <ul> <% loop Children %> <li>Item {$Pos}</li> <% end_loop %> </ul> </div> <% end_loop %>
Assuming SomeDataList() contains 5 items, the output would be:
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Item 1 | Item 3 | Item 5 |
| Item 2 | Item 4 | . |
“Right-heavy” stacking:
Using the same above example:
<% loop ColumnData.Stacked(3, 'Children', 0) %> <div style="float: left"> <h3>Column {$Pos}</h3> <ul> <% loop Children %> <li>Item {$Pos}</li> <% end_loop %> </ul> </div> <% end_loop %>
Assuming SomeDataList() contains 5 items, the output would be:
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Item 1 | Item 2 | Item 4 |
| . | Item 3 | Item 5 |
统计信息
- 总下载量: 2.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-07-24