burnbright / silverstripe-gridstructuredcontent

Allows structuring Content editor content into CSS grid system layouts
12 stars 3 forks source link

SilverStripe Grid Structured Content Module

The layout-with-tables killer.

Why

Problem: structuring content beyond single columns.

Existing solutions:

New solution: use the CSS grids we've come to know and love

This can be done by splitting up 'Content' field with a short delimiter string, and also storing a (sub)grid structure. The grid strucutre could be predefined by a designer, or edited by the user. This means defining the appropriate nesting of rows, columns, and width each column spans.

The same TinyMCE editor interface can be used, with the only difference being that you choose what part of the grid you are working on. On save, the seperate grid sections are concatenated into the 'Content' db field, and are delimited by a front-end invisible string.

When rendering on the front-end, the defined grid structure is traversed (depth first), dropping the delimited Content into the appropriate areas.

This idea relies on the fact that most grid systems are the same. Most have:

For example, here is the bootstrap structure

<div class="row">
    <div class="span4">...</div>
    <div class="span8">...</div>
</div>

Converted to a generic SilverStripe template:

<div class="row">
    <% loop Columns %>
        <div class="span{$Width}">
            $Content
        </div>
    <% end_loop %>
</div>

The minor differences between grid systems should be handled by using a slightly different row template.

Benefits:

Research

List of CSS Grid Systems/Frameworks

Javascript Grid Layout Editors

Similar ideas

Screenshots

Editor

Configuration