Hi all,

I'm sure what I'm trying to do is simple, but after hours searching for the solution I'm totally stumped. I've created a custom module, enabled it, and got the block to display. What I want to do now is create a custom theme for that block. So I just want to override block.tpl.php for that block only. Can someone point me in the right direction? I've tried adding the mymodule_theme function to mymodule.module, but the custom theme still isn't getting called.

Thanks,
Joe

Comments

arthurhanlon’s picture

I'm still learning Drupal but I guess, if you use something like Firebug to look at Drupal.org's site, you'll see that each block type has a specific class as well as the generic class. You could try starting there.

e.g. the blocks each have the class "block" but the user block also has the class "block-user" and likewise for the others.

I would have to suppose this kind of functionality is in place for the very purpose.

Hope this helps a bit,
Arthur

denverjoe’s picture

Thanks Arthur,

Yeah, I did see that you could style the block via css, but what I was trying to do was override the actual markup for that block. I'm going to see if I can get the results I want using only css.

Thanks

denverjoe’s picture

I finally figured it out. You just put a block-[block name].tpl.php in your themes directory and that will override block.tpl.php.

wla_g’s picture

If you are just dealing with css, you could add a specific css file to your module with hook_init like

function <my_module>_init() {
  drupal_add_css (drupal_get_path('module', '<my_module>') . '/<my_module>.css');
}

In this css you put the specials for your block.

Regards
Werner