Hello,

I'm loving the concept of this module, however, I'm lost in the documentation.

I don't see where to add the code

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

return phptemplate_block($block);

into the template file of my custom ZEN theme. More specifically, I don't see where the [yourtheme]_block($block) is located in the template file. Any help would be appreciated.

Related, does this code need to be modified, or can it be added as-is?

Comments

duckjerk’s picture

I am having the same problem. I can't tell where to put the code.

FlymastaFlex’s picture

just put

 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);



}

into your template.php

Cory Goodwin’s picture

I tried using this but it did not work for me. I am working on a zen sub theme. The zen subtheme has this written in the template.php

* theme_block() becomes zen_block()
* subtheme_preprocess_block(&$vars) to add variables to the block.tpl.php

When i copy the above code my custom blocks disappear. When I select "none" for the block style the blocks reappear.

Any suggestions appreciated.

Anonymous’s picture

Hi,

I'm looking into this and from what I found, the issue could be explained if the name(s) you use for your block templates wouldn't be valid php function names. (A dash (-) in the name being a probable suspect). If this is the case, the following code might solve your problem. Notice the extra parameter in the call to _phptemplate_callback():

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

  return phptemplate_block($block);
}

If it doesn't, please try a blocktheme name with only alphanumerical characters.

Gertjan

Miteto’s picture

All Zen subthemes rely on Zen theme itself so applying the function function zen_block($block) to Zen's template.php and putting those block templates into Zen root folder does the job.

lefnire’s picture

Feasible interim, but we'd like to not mess with Zen root when developing subthemes. This issue might shed some light on the matter -- I too want this module to work with zen subs.

Edit: the hyphens-removal fixed the issue for me

liliplanet’s picture

Title: Implementing code with custom ZEN theme » Implementing code with custom theme

Hi,

I'm having the same problem with a custom sub-theme.

Theme is called 'bluebreeze', but using the fixed width theme inside the bluebreeze folder which I called 'bluesky' (thus my theme).

In template.php the following:

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

have created redblock.tpl.php and tried it in the bluebreeze and bluesky folder (and still no difference).

in admin/settings/blocktheme:

redblock|red block

When I change function to bluebreeze_block the blocks go away ..

Please, would most appreciate any help .. and thank you.

Lilian

liliplanet’s picture

* bump * sorry ... has someone perhaps found the solution to implementing this on a sub-theme?

Jeff Burnz’s picture

Last time I looked (a while ago now...) Zen 5x printed an array of classes via the $block_classes variable.

You should be able to do something like this in the your subthemes proprocess function:

 //omit php tags...
function STARTERKIT_preprocess_block(&$vars) {
  if (module_exists('blocktheme') && isset($vars['blocktheme'])) {
    $block_classes[] = $vars['blocktheme'];
  }
}

I just stumbled accross this as I was writing an article on how to implement blocktheme classes per region in the Genesis theme (which is for D6 only) and Zen 5 & 6 work in similar ways using preprocess functions.

seakayjay’s picture

Has anyone find out how to get it work in zen subtheme yet?

amateescu’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still an issue?

amateescu’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Blocktheme 5.x is not maintained anymore. Please upgrade to the latest 6.x release if possible.