I'm Relatively new to drupal and still climbing the learning curve. On one section of my page, I have multiple blocks from same content type. According to the Handbook (http://drupal.org/node/104319) I should be able to style blocks individually by div id, but mine are outputting with just a list of classes that are identical for each block. So, mine are outputting as:

div class="block"
div class="block-content"
div class='view view-subpage'
div class='view-content view-content-subpage'
div class="node"

With no way to style each block.

I would like to be able to wrap each block with an automatically generated div id like "view-subpage-1", "view-subpage-2" etc.

I've combed the forums and handbook already and haven't figured it out. Any help is greatly appreciated. Thanks!

Comments

vm’s picture

a link to the site would be helpful.

a blocks delta can also be found by going to administer -> blocks and hovering over the configure link
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Ustas’s picture

Usually, blocks have ids in html code like "block-block-" or "block-user-". Try to look through the code more carefully. Or let to have a look on your site.

ryannuckel’s picture

Ustas -- that's what's odd, everything I'm reading assumes that blocks will output with ids of block-module-delta, but it doesn't seem to be happening in my case.

You can see the problem here: http://braddockactivearts.org/projects/example . Near the top will be a Project Sub-Page -- that's the block in question.

Thanks!

vm’s picture

link not working ....

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

ryannuckel’s picture

I edited the block.tpl.php file to output blocks with a div id, with the following code:

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="block block-<?php print $block->module ?>">
<?php if ($block->subject): ?>
  <h2><?php print $block->subject ?></h2>
<?php endif;?>

So now I get a div id, but without delta values:

<div id="block-views-project_subpage" class="block block-views">

That should be "block-views-project_subpage-0" but no such luck. I am weak with PHP, so perhaps I'm missing something that will be obvious to you...

dvessel’s picture

I believe the delta here is "project_subpage". The delta does not have to be numeric. It's the part that's specific to the block assigned by the module and "project_subpage" sounds specific to one of your views.

One way to double check is to look inside the block configuration page. Mouse over the link to "configure" the block. The link should end with the delta.

joon park
www.dvessel.com

vojnar’s picture

I have modified block.tpl.php line for the following:

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>-<?php print " ".$id; ?>">