PHP code example of kinglozzer / silverstripe-columnedlist

1. Go to this page and download the library: Download kinglozzer/silverstripe-columnedlist library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kinglozzer / silverstripe-columnedlist example snippets


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 %>

<% 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 %>