Skip to content

Instantly share code, notes, and snippets.

@berkes
Created September 30, 2010 22:03
Show Gist options
  • Save berkes/605407 to your computer and use it in GitHub Desktop.
Save berkes/605407 to your computer and use it in GitHub Desktop.
grid style Drupal view, but use 960.gs instead of tables.
<?php
/**
* @file views-view-grid.tpl.php
* Default simple view template to display a rows in a grid.
*
* - $rows contains a nested array of rows. Each row contains an array of
* columns.
*
* @ingroup views_templates
*/
?>
<?php if (!empty($title)) : ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $columns): ?>
<div class="grid-12 alpha omega">
<?php foreach ($columns as $counter => $item): ?>
<?php
if ($counter == 0) {
$alpha_omega = ' alpha';
}
elseif (count($columns) == ($counter + 1)) {
$alpha_omega = ' omega';
}
else {
$alpha_omega = '';
}
?>
<div class="grid-3<?php print $alpha_omega ?>">
<?php print $item; ?>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
@berkes
Copy link
Author

berkes commented Sep 30, 2010

Uses a container of 12-grid-units, with rows of four items. Resulting in each grid-item being 3 units wide.

Could be recalculated with any amount. But make sure to have the settings in views resemble your amounts in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment