Project:Block Theme
Version:6.x-1.0-beta1
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,

I've downloaded this excellent module, but it doesn't work.

I've created in my theme folder, 2 new block-themes with there respective block-*.tpl.php where i pasted my block.tpl.php code with the name of the block-theme as class. An example for one of them :

<div class="block block-<?php print $block->module; ?> block-navigation " id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
         <h2>
             <span><?php print $block->subject; ?></span>
         </h2>
         <?php print $block->content; ?>
         <div class="block-bottom">&nbsp;</div>
    </div>

In a new stylesheet named "blocktheme.css", i've declared all my specific classes.
I've configured my navigation block with its new blocktheme but there is no change. Only the general classes in style.css are taken.

I'm not fluent in english nore in php ! :-)

Though i don't know what to do when you wrote :
# Drupal 6.x only: Optionally, use the new $blocktheme variable in your block.tpl.php or block-*.tpl.php files to change template behaviour depending on the chosen blocktheme value
Might i modify my block.tpl.php ? How do i ? Could you give me the new code ?

Many thanks for your help.

Comments

#1

Status:active» fixed

After multiple tries, i've found the solution.
For those who want to integrate this module in Drupal 6x., here some more explanations :

- Install your blocktheme module normaly.
- create the name of your new template, customtemplate for example, configuring your module.
- create a new file in your theme folder "site/all/themes/your-default-theme/" named blocktheme-customtemplate.tpl.php
- copy/paste the code from your block.tpl.php to your new file blocktheme-customtemplate.tpl.php
- add the name of your new blocktheme as customtemplate here in your file blocktheme-customtemplate.tpl.php :

    <div class="block block-<?php print $block->module; ?> customtemplate " id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
         <h2>
             <span><?php print $block->subject; ?></span>
         </h2>
         <?php print $block->content; ?>
         <div class="block-bottom">&nbsp;</div>
    </div>

- now, you can add your specific classes of your new template in your steelsheet style.css , no need to create another specific steelsheet,
like that (for example) :

.customtemplate {
}
.customtemplate h2 {
  padding-top: 0.5em;
  background-color: #fddfbc;
  font-size: 1.2em;
  font-weight: bold;
  text-align: center;
}
.customtemplate .item-list ul li {
  border: 1px dashed #c8bfbf;
  padding-left: 3px;
}
.customtemplate .more-link {
  margin: 0 6px 0 0;
}
.customtemplate .block-bottom {
  background: #000000 none repeat;
}

- at least, attribute your new blocktheme-template named Custom Template for example, to your block.

And that's all ! Remember you never have to employ the name blocktheme here, except when you create your new template file named
blocktheme-customtemplate.tpl.php.

#2

Having a few problems here! The created theme is not showing in the colour theme selection box

I created "redblocktemplate\Red Block" in Block Theme

I then created a file in my current themes folder called "blocktheme-redblocktemplate.tpl.php"

I then pasted the code from my "block.tpl.php" into the file ie...

<?php
// $Id: block.tpl.php,v 1.3 2007/08/07 08:39:36 goba Exp $
?>

<?php
if (!empty($block->subject)):
?>

<?php
print $block->subject
?>

<?php
endif;
?>

<?php
print $block->content
?>

I then changed "block.tpl.php" to "redblocktemplate.tpl.php"

I then pasted the above text ie...

<?php
print $block->subject;
?>

<?php
print $block->content;
?>

 

And changed the text "customtemplate" with "redblocktemplate"

So this is what I have in my "blocktheme-redblocktemplate.tpl.php" file....

<?php
// $Id: redblocktemplate.tpl.php,v 1.3 2007/08/07 08:39:36 goba Exp $
?>

<?php
if (!empty($block->subject)):
?>

<?php
print $block->subject
?>

<?php
endif;
?>

<?php
print $block->content
?>

<?php
print $block->subject;
?>

<?php
print $block->content;
?>

 

I then as suggested, added the following to my style.css... (presume it doesnt mater where this goes in the .css file?)

.redblocktemplate {
}
.redblocktemplate h2 {
padding-top: 0.5em;
background-color: #fddfbc;
font-size: 1.2em;
font-weight: bold;
text-align: center;
}
.redblocktemplate .item-list ul li {
border: 1px dashed #c8bfbf;
padding-left: 3px;
}
.redblocktemplate .more-link {
margin: 0 6px 0 0;
}
.redblocktemplate .block-bottom {
background: #000000 none repeat;
}

Where am I going wrong?

Many Thanks in advance

#3

Belphi,
I'm sorry you had to figure this out by yourself, but I'm glad you did.
I don't get an email message when someone posts a new issue, and I still don't know if that can be configured.
What you did is exactly what I meant by # Drupal 6.x only: Optionally, use the new $blocktheme variable in your block.tpl.php or block-*.tpl.php files to change template behaviour depending on the chosen blocktheme value. I will add an example to the README file of the next release. Adding it to the Project introduction would be very confusing to Drupal 5 users.

#4

Status:fixed» closed (fixed)

Hi DMcGrath,

I consider your comment as a duplicate of #283489: The created theme is not showing in the colour theme selection box and will answer it there.

#5

I think I am having the same issue. I have taken the "optional" approach where I copied the block.tpl.php file and renamed it. Where does the $blocktheme variable go? I have added "drupal_add_css" to point the tpl.php file to my style.css file.

Is the $blocktheme variable required?

I have positioned the footer links into the footer block and simply want the links to display inline.

#6

@Stomper:
The $blocktheme variable is not required. In your situation, with a renamed copy of the block.tpl.php file, you don't need it at all.
Please read comment #1 from Belphi. I think it's very good.

Gertjan Idema

#7

I made the changes as suggested but it still is not working. I used Firebug and it seems the block in question is placed in a "block-inner" div not the custom block theme div.

Suggestions?

#8

Is #7 a bug?

#9

Any suggestions on how to address this issue?

It seems the changes I've made to the .tpl are not being recognized and thus the block theming is not taking effect.