定制 axllent/silverstripe-list-to-bootstrap-grid 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

axllent/silverstripe-list-to-bootstrap-grid

Composer 安装命令:

composer require axllent/silverstripe-list-to-bootstrap-grid

包简介

Create a Bootstrap grid layout from a SilverStripe List

README 文档

README

Easily create a 12-column grid system from a SilverStripe List. The class returns an ArrayList of rows each containing a items (whatever the List was), the column width, and optional offset (to center-align the last row if it has fewer items than the specified value).

This was developed for Bootstrap, however can easily be modified to suit any CSS grid system.

Requirements

  • SilverStripe ^4 || ^5

Installation

Install via Composer

You can install it via composer with composer require axllent/silverstripe-list-to-bootstrap-grid

Basic usage

In your page controller:

<?php

use Axllent\ListToBootstrapGrid\ListToBootstrapGrid;

class CategoryPageController extends PageController
{
    public function getProductRows()
    {
        return ListToBootstrapGrid::create(
            $this->Products(),  // The list you wish to convert
            $columns = 3,       // Columns per row - must divide into 12!
            $center = true      // Center-align last row if < than $columns
        );
    }
}

Then in your CategoryPage.ss template:

<% loop $ProductRows %>
    <div class="row">
        <% loop $Items %>
            <div class="col-sm-{$Up.Width}<% if $First && $Up.Offset %> col-sm-offset-{$Up.Offset}<% end_if %>">
                <h2>$Title</h2>
                ...
            </div>
        <% end_loop %>
    </div>
<% end_loop %>

统计信息

  • 总下载量: 354
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固