Don't know if anyone else will find this useful but I was working to replace the grid view supplied by the views module with BP spans. Here's what I have so far. It seems to work except for the part where you have to determine what the center column width is. I wasn't sure how to get that pulled into the template page and how to check whether it's two or three columns so I have a hard-coded value of span-18.

(goes into blueprint/views-view-grid.tpl.php)

<?php if (!empty($title)) : ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<div class="views-view-grid">
    <?php foreach ($rows as $row_number => $columns): ?>
      <?php
        $row_class = 'row-' . ($row_number + 1);
        if ($row_number == 0) {
          $row_class .= ' first';
        }
        elseif (count($rows) == ($row_number + 1)) {
          $row_class .= ' last';
        }
      ?>
      <div class="views-grid-row <?php print $row_class; ?>">
        <?php foreach ($columns as $column_number => $item): ?>
        
        <?php
        $colspan_number = intval(18/((count($rows,1)/count($rows,0))-1));  /*the 18 here corresponds to the center column span width, not sure how to pull this from the preprocess variables*/
        $column_class = 'span-' . $colspan_number;
        if ($column_number == 0) {
          $column_class .= ' first';
        }
        elseif (count($columns) == ($column_number + 1)) {
          $column_class .= ' last';
        }
      ?>
          <div class="<?php print $column_class; ?>">
            <?php print $item; ?>
            
          </div>
        <?php endforeach; ?>
      </div>
    <?php endforeach; ?>
</div>

Comments

designerbrent’s picture

Version: 6.x-1.3 » 6.x-2.x-dev
Status: Active » Postponed
Peng.Pif’s picture

Hey Sean, thanks for this, it's just what I was looking for and is very usefull.

I've run into a problem though, I have 4 columns per row, but once I reach 5 items in the grid, the second row displays the column content (5th item) beneath the 3rd item in row 1.

Adding a 6th item creates a new row and adds this vertically in line with the 4th item on row 1.

Any solutions to this would be very much appreciated.

Thanks!

Peng.Pif’s picture

Sorry, just messing with Views settings i have found that this only happens when Sort Criteria is set to Node: Title (Ascending).

Descending works fine and if I remove the Sort Criteria all together it is ok.

Would this be a Views issue?

Thanks.

sean_a’s picture

sorry super late response, I had my notifications turned off.

is containing div (the div in which this grid view is displayed) smaller than 18? If so you have to manually adjust the number in the $colspan_number to fit your div.

It's a hack but I wasn't sure how to include the layout span number from the theme.