Theming blocks individually, by region, or by module
Designers can create multiple tpl.php files for blocks based on the specific block, the module that created the block, or the region that the block appears in.
Template files are searched in the following order:
- block-[module]-[delta].tpl.php
- block-[module].tpl.php
- block-[region].tpl.php
- block.tpl.php
For example, the user login block has a delta of '0'. If you put it in the left sidebar, when it's rendered, PHPTemplate will search for the following templates in descending order:
- block-user-0.tpl.php
- block-user.tpl.php
- block-left.tpl.php
- block.tpl.php
You can find the block's module and delta by looking at the html source of a page: each block's main DIV has the following classes and IDs:
<div class="block block-{module}" id="block-{module}-{delta}"> Note that custom blocks created in the admin UI count as coming from block.module, so their template is 'block-block-[delta]'.
Styling with CSS
These classes and IDs also let you apply CSS rules to blocks selectively: all blocks, all blocks from a particular module, or just one block. (To style blocks by region, use the DIV that wraps an entire region in your selector.)
Note that the delta is usually a number: each module numbers the blocks it provides, starting at 0. In some cases, the delta can also be a name: eg to style blocks created with the Views module, use block-views-[name of your block].tpl.php.

Need a prime block.tpl.php also
I found that
block-[module].tpl.phpdid not take effect unless there was also a custom (copy of)
block.tpl.phpin the theme dir also. It may have just been Zen template that does odd things with template suggestions.
Also, the module part of the filename is verbatim - using underscores not dashes, so for local_menu.module it's
block-local_menu.tpl.phpwhich is a little inconsistent, but makes sense.
.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |