Hey Stalski,

I noticed that the zebra striping on the blocks is different than the zebra striping on the page displays. For example, in blocks the first row starts with even, in the page, the first row is odd. This is a very minor issue, but it creates a weird user experience for my site as I've converted the filter bar into AJAX and I'm using AHAH to bring back the filtered messages, so when a filter is used the striping changes.

I have a pretty hacked out version of heartbeat, so I was curious if this is a known issue before I go searching for the source of the problem.

Comments

Stalski’s picture

Status: Active » Closed (won't fix)

I am sorry, I noticed the zebra is a static count in core. There is no way in drupal6 to reset that after processing the first themed list. I can only refer to this issue where the same answer stands: #360550: how to reset $zebra/$id for each instance of a view

Anonymous’s picture

$zebra is not reset per instance, e.g. two block instances of the same view will accumulate counts. To add more granularity, you can do this in your template.php (and flush cache after adding):

/**
 * Implements hook_preprocess().
 */
function mytheme_preprocess(&$variables, $hook) {

  // Track run count for each hook to provide zebra striping.
  // See "template_preprocess_block()" which provides the same feature specific to blocks.
  $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1;
  $variables['zebra_hook'][$hook] = ($count[$hook] % 2) ? 'odd' : 'even';
  $variables['id_hook'][$hook] = $count[$hook]++;
}

Now $zebra_hook is an array with the counts per hook. For example, you can use $zebra_hook['node'] or $zebra_hook['my_entity']. This allows for a bit more granularity in $zebra striping and $id counting.