diff --git a/template.php b/template.php index 5210c1a..8973569 100755 --- a/template.php +++ b/template.php @@ -41,7 +41,20 @@ function basic_preprocess_node(&$vars) { function basic_preprocess_block(&$vars, $hook) { // Add a striping class. - $vars['classes_array'][] = 'block-' . $vars['zebra']; + $vars['classes_array'][] = 'block-' . $vars['block_zebra']; + // Add first/last block classes + $first_last = ""; + // If block id (count) is 1, it's first in region. + if ($vars['block_id'] == '1') { + $first_last = "first"; + $vars['classes_array'][] = $first_last; + } + // Count amount of blocks about to be rendered in that region. + $block_count = count(block_list($vars['elements']['#block']->region)); + if ($vars['block_id'] == $block_count) { + $first_last = "last"; + $vars['classes_array'][] = $first_last; + } } /** @@ -188,4 +201,4 @@ function basic_menu_local_tasks(&$variables) { return $output; -} \ No newline at end of file +}