Access Keys


Grid Rows Module

Posted by Gordon Anderson on 24 October 2012 | 0 Comments

Example of 4 items laid out in a grid 3 cells wide


  • Adds a convenience method for templates that pre-splits a dataset into rows


git clone git://
cd weboftalent-gridrows
git checkout stable24

The name of the installation directory does not matter

Usage - Templates

An example template is shown below.

  • The parameters for SplitSetIntoGridRows are the method name to return a list of DataObjects, and the number of DataObjects to show per row.
  • Start your row in HTML, e.g. <tr> or <div class="row">
  • The DataObjects in each row are available from the call <% control Columns %>
  • Render each DataObject as appropriate, in this case use Twitter bootstrap.
<% control SplitSetIntoGridRows(AllChildren|3) %>
<div class="row">
<% control Columns %>
<div class="span3"><h4><a href="$Link">$Title
<a href="$Link"><% control Screenshot.SetWidth(300) %><img src="$URL" alt="$Title"/><% end_control %></a>
</div><!-- end of span 4 -->
<% end_control %>
</div><!-- end of row -->
<% end_control %>

Silverstripe Version Compatibility

2.4 only (tested with 2.4.5+) - stable24 branch

Tags: , ,


No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments