Introducing Grid, New in ExpressionEngine 2.7

A long-requested feature is here. ExpressionEngine 2.7 is coming soon and includes a new fieldtype that allows authors to use grouped fieldtypes to publish any number of rows of related content within an entry. We’re calling it Grid, and it’s great for photo galleries, addresses, product details, baseball statistics and more.

A Grid field can be configured with multiple columns, each capturing data with any of ExpressionEngine’s existing fieldtypes, including any Grid-compatible third-party fieldtypes. From there, each channel entry can have a dynamic number of rows in the Grid field to suit the needs of that particular entry.

Let’s take a look at some real-world use cases for Grid.

Frequently, an author would like to attach photos to accompany a channel entry. The number of photos needed varies by entry, and the author would like to add a description and a photo credit. So we will create a Grid field called “gallery” and group a file field, text input and a rich text editor to capture and group this information.

To display our images in a template, we’ll use a tag pair along with prefixed variables so it’s easy to see where a variable is coming from:

{gallery}
    
<figure>
        <
img src="{gallery:image}">
        <
figcaption>Photo by {gallery:credit}</figcaption>
    </
figure>
    
{gallery:description}
{
/gallery} 

Another great use for Grid is numeric data. Let’s capture some baseball player statistics from a single game in a field called “stats”. We will use a Relationships field to relate the stats to a single player, then use text fields to capture the stats which can easily be tabbed across to quickly enter information:

Displaying this information is easy. Since this is tabular data, we’ll tell Grid to make a table for us:

<h1>Player Stats</h1>
{stats:table} 

And since the data is all numeric, we can ask Grid to give us simple statistics:

Most hits{stats:highest column="hits"}
Average RBI
{stats:average column="rbi"}
Total runs scored
{stats:sum column="runs"}
Players with runs
{stats:total_rows search:runs=">0"

As illustrated, the new Grid field can lend its flexibility to a wide range of needs. This feature and much more are coming soon in ExpressionEngine 2.7.

.(JavaScript must be enabled to view this email address) or share your feedback on this entry with @ellislab on Twitter.