[Drupal] How to theme a particular region of block in Drupal 6?

| | 1 min read

Every one will be familiar with the template files.Now lets see the case to theme a block. Here we can use block.tpl.php for theming the block but what if we want to theme the block specifically by a region?In one of my recent projects I need to theme the block in a specific region, I cannot use block.tpl.php as this may cause all other blocks to change.While digging a bit deeper I found out that this can be done easily by using a template for that particular region.Let's see how it can be done so.

Consider that you have the following regions in your theme info file, header, content, sidebar, footer_left, footer_middle and footer_right.Here you need to theme the footer_middle region quiet differently from footer_left and footer_right, this can be done only by using a template file separately for that particular region.

We need to follow name conventions correctly inorder to work on, when using tpl for a particular region we should name it as block-regionname.tpl.php, so in the above example we should name it as block-footer_middle.tpl.php. And our next concern will be about the contents inside our tpl, but not to worry just start up with the contents of block.tpl.php, and get your block themed.

I'm sure this may solve your problem to theme the block in a particular region.