All my blocks have div of defaultblock

calebm12 - October 9, 2009 - 23:36

I would like to use some css to change individual blocks. However using firebug, all of my blocks have a div id of defaultblock. how can i assign ids to specific blocks so that i can then add css?
I am using the marinelli theme.

I would look at the themes

nevets - October 10, 2009 - 02:04

I would look at the themes block.tpl.php file, Garlands file looks like

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

<?php if (!empty($block->subject)): ?>
  <h2><?php print $block->subject ?></h2>
<?php endif;?>

  <div class="content"><?php print $block->content ?></div>
</div>

and you can see how the set both id and class.

the marinelli block.tpl.php

calebm12 - October 10, 2009 - 17:41

the marinelli block.tpl.php file is this

<div class="defaultblock">
    <h2><?php print $block->subject; ?></h2><!--block title-->
   <div class="blockcontent"><?php print $block->content; ?></div>
</div>

do i just subsitute in the garland coding?

I would use

nevets - October 10, 2009 - 17:46

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="defaultblock">
    <h2><?php print $block->subject; ?></h2><!--block title-->
   <div class="blockcontent"><?php print $block->content; ?></div>
</div>

this way existing theming for blocks will continue to work.
You could also try this for the first div
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="defaultblock clear-block block block-<?php print $block->module ?>">

that works great. thanks

calebm12 - October 11, 2009 - 18:30

that works great. thanks

 
 

Drupal is a registered trademark of Dries Buytaert.