Hi, I'm having a problem getting my theme to do what I want. It's based on the deco theme. I have multiple blocks on the left sidebar. I want the border for the first block to show up, but I'd like to be able to remove the border on other blocks. When the blocks are generated they are given the same class name. So, I figured I could solve this problem by generating dynamic class names for each block by adding a variable in block.tpl.php that would add a number to the class name each time it is displayed. Then theme each accordingly.

I initialized a variable in template.php in the following function:

function phptemplate_preprocess_page(&$vars) {
  $vars['leftSidebarBlockNumber'] = 1;
  ...

and I added the variable to block.tpl.php - with incrementer

<div class="sidebar-border<?php print $leftSidebarBlockNumber++;?>">

but, nothing is showing.

Can someone tell me what I'm missing here? Or, is there a better way to do this?

Comments

mm167’s picture

try ...

print $block->delta;

may be..that's what u want ..

meisdug’s picture

yes, that's exactly what I need. I can't believe I hadn't figured that out before. Thank you very much.

mm167’s picture

ha ha ....will u buy me a beer?

any way ..good luck..

meisdug’s picture

The previous comment does what I need, but I'm still curious as to why the first solution I proposed in my original post doesn't work. Can someone enlighten me?