I'm seeking the best practises for theming some blocks using a same template file, but my problem is that blocks may not be used in a same region, and they can also be used in one module that has a bundle of different blocks with different themes.

How can I achieve this?


Block Theme module will be really helpful. You have a select box where you can choose different tpl.php files for each block you configure


The block.tpl.php is the only template that matches all blocks, but the only thing it effects is the wrapping html. This is good if you want to theme blocks to have round corners, or stuff like that. The actual content of the block will not be effected by this.

Since modules can render a block in many ways, you can't really create a single template file where you can handle how the output should be. If you want to alter the output of many different blocks, the only way to go it to handle them on a case by case basis.

You should be aware that CSS goes a long way and you might not need to alter any output or use any template to theme the blocks, if you write the needed CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.