/ Published in: PHP
Sometimes, the first or last block in a region needs to be styled different than the rest. This solution do this in simple way for Drupal 6.
(originaly code from [email protected]: http://drupal.org/node/293188#comment-1282186)
(originaly code from [email protected]: http://drupal.org/node/293188#comment-1282186)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function themename_preprocess_block(&$vars, $hook) { static $counts; $region = $vars['block']->region; $count = $counts[$region]; $extremity = ''; if($vars['id'] == 1) $extremity = 'first'; if($vars['id'] == $count) $extremity = 'last'; $vars['classes'] .= $extremity != '' ? ' ' . $extremity : ''; } ?> You need to change themename to your themplate name.
URL: http://drupal.org/node/293188