0

I'm trying to apply this to each block in a region:

http://figure-w.co.uk/zebra-striping-in-php/

He is generating zebra striping per div here, which is fine, but I'm wondering how I would apply this to each block in a given region.

Would I use something like block_list($region)?

This code is supposed to go in template.php

function likemind_zebra($id = 'global', 
                     $odd_class = 'odd', $even_class='even') {
  static $cursor = array();
  if(!isset($cursor[$id])) {
    $cursor[$id] = 1;
  }
  return $cursor[$id]++ %2? $odd_class: $even_class;
}

I'm just trying to figure out how I would get it to apply to each block in a region, rather than the whole region.

1

1 Answer 1

1

A $block_zebra variable is defined within the block templates to allow for the ability to zebra stripe them in a region.

See hook_preprocess_block() for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.