...and do not see the benefit over hand-theming blocks for my use case. All I wanted to do is to color the admin blocks in a reddish color.

Instead of editing template.php, adding a .tpl.php and finally define theming in style.css I just had to add some lines to style.css, referring to the (few) relevant block ids. Still I'd be interested in a more elegant, integrated solution, but as stated in subject, I didn't get it done.

I tried to add the following lines to my adaption of the "Zen" theme:

function zen_block($block) {
  if (module_exists('blocktheme')) {
    if ( $custom_theme = blocktheme_get_theme($block) ) {
      return _phptemplate_callback($custom_theme,array('block' => $block));
    }
  }

  return phptemplate_block($block);
}

However, my pre-defined .tpls seem not to have been taken into account... can you see why?

Thanks,
Moltke

Comments

JacobSingh’s picture

Hmm.... Did you configure it first from the admin screen? Can you paste the contents of the admin textarea for defining the custom blocks?

In your case, yes, I'd just use some CSS probably. This is really for when you've got dozens of blocks which are using a few different templates to avoid code cruft.

Moltke’s picture

In fact, I did a rollback of all settings, but basically I had the following setting:

superblock|SuperUser-Template

referring to an existing superblock.tpl.php in my theme's directory. That .tpl was essentially identical to the regular block.tpl.php, it just added another div/div class/div id (choose your pick) to wrap all the block, but nothing ever appeared in my site's source code. The relevant blocks had "SuperUser-Template" enabled, of course.

So there's no syntax problem with my above-mentioneds code in template.php? Do I have another chance to check whether it works? What does the module do in case of "file not found" (that's how I started out)?

- Moltke

masande’s picture

i am also having this problem. i've enabled the module, configured the admin options, created a custom block template, assigned a template to a block and included the aforementioned code into my theme's template.php file. this has had no effect on the block i am trying to use a my custom block theme.

following is what i have entered in the blocktheme admin:
adminblock|Admin Block

i created a template file called adminblock.tpl.php per the instructions.

my theme is custom and called q1000a so i added the following to my template.php:

function q1000a_block($block) {
  if (module_exists('blocktheme')) {
    if ( $custom_theme = blocktheme_get_theme($block) ) {
      return _phptemplate_callback($custom_theme,array('block' => $block));
    }
  }

  return phptemplate_block($block);
}

what am i doing wrong?

masande’s picture

my bad. i specified a block theme for the wrong block. once i applied the block theme to the correct block everything fell into place.

this is a handy theming module.

druvision’s picture

Works for me on the new version of Ecopolitan
What a great invention!

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)

JacobSingh’s picture

Status: Active » Closed (works as designed)

Cool! I'm glad this is useful for people. If anyone wants to contribute, I think some better docs and a better admin interface would be useful. If not, whatever, glad you enjoy :)

jcrichto’s picture

This would only work if I had some text in the body of the block under admin -> site building -> blocks. When left blank, it lost reference to my external tpl.php file.