Created
August 17, 2011 20:01
-
-
Save gagarine/1152457 to your computer and use it in GitHub Desktop.
views theme.inc arround line 500
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function template_preprocess_views_view_unformatted(&$vars) { | |
$view = $vars['view']; | |
$rows = $vars['rows']; | |
$vars['classes'] = array(); | |
// Set up striping values. | |
foreach ($rows as $id => $row) { | |
$row_classes = array(); | |
$row_classes[] = 'views-row'; | |
$row_classes[] = 'views-row-' . ($id + 1); | |
$row_classes[] = 'views-row-' . ($id % 2 ? 'even' : 'odd'); | |
if ($id == 0) { | |
$row_classes[] = 'views-row-first'; | |
} | |
if ($id == count($rows) -1) { | |
$row_classes[] = 'views-row-last'; | |
} | |
// Flatten the classes to a string for each row for the template file. | |
$vars['classes'][$id] = implode(' ', $row_classes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment