The created theme is not showing in the colour theme selection box
| Project: | Block Theme |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
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 $
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>
I then changed "block.tpl.php" to "redblocktemplate.tpl.php"
I then pasted the text you suggested ie... again changing the name to "redblocktemplate.tpl.php"
<?php
// $Id: redblocktemplate.tpl.php,v 1.3 2007/08/07 08:39:36 goba Exp $
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>
<div class="block block-<?php print $block->module; ?> redblocktemplate " 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"> </div>
</div>
So I have both of these bits of code sitting in my "blocktheme-redblocktemplate.tpl.php" file, one under the other as above.
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?
Any chance you could upload the correct files I can replace, thanks
Many Thanks in advance
D

#1
Hi Dominic,
First I noticed that in your issue posting you mentioned:
I created "redblocktemplate\Red Block" in Block Theme
This should be:
"redblocktemplate|Red Block" with | instead of \
Furthermore you mixed up the two possible ways to address this issue.
One way is to create your own template file (redblocktemplate.tpl.php in your case). I this case you have to add the css class name as a literal to your template file:
<?php
// $Id: redblocktemplate.tpl.php $
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?> redblocktemplate">
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>
The other way is to stick with a default template (block.tpl.php or block-block.tpl.php for example) and use the $blocktheme variable:
<?php
// $Id: block.tpl.php $
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module .' '. $blocktheme ?>">
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>
The advantage of the second possibility is that you can use one template file for several block theme's if the only differences are in the css.