My block disappears!

lavanyashastri - October 14, 2008 - 04:46
Project:Block Theme
Version:5.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I think your module sound great but cant get it to work.
I am fairly new to both drupal and css so i may be missing something obvious here.
Here is what I did:
created a copy of block.tpl.php and renamed it to superblock.tpl.php
below are the contents of superblock.tpl.php

<div class = "superblock">

<div id="block-<?php print $block->module .'-'. $block->delta ?>" class="block block-<?php print $block->module ?>">
  <?php if ($block->subject): ?><h2><?php print $block->subject ?></h2><?php endif; ?>
  <div class="content"><?php print $block->content ?></div>
</div>

</div>

i added the following to the bottom of my template.php

function myteam_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);
}

where myteam is the name of my theme.

This is what I added to my style.css

.superblock {
background:red;
}

In admin>site config>blocktheme i added the following line
superblock.tpl.php|Superblock
I am able to select the 'superblock theme' for one of my blocks but when i hit submit my block disappears!
I think i have followed all the steps...but it seems to me that i have missed out something crucial.
If someone could point me in the right direction i would really appreciate it.
Thanks

#1

lavanyashastri - October 14, 2008 - 04:51

I have inspected my page using FireBug and I have found this :

<!-- begin sidebar-right -->
<!-- PHPTemplate was instructed to override the superblock.tpl.php theme function, but no valid template file was found. -->

#2

lavanyashastri - October 14, 2008 - 05:04

I added the "superblock" literal to my superblock.tpl.php

<div class = "superblock">

<div id="block-<?php print $block->module .'-'. $block->delta ?>" class="block block-<?php print $block->module ?>superblock">
  <?php if ($block->subject): ?><h2><?php print $block->subject ?></h2><?php endif; ?>
  <div class="content"><?php print $block->content ?></div>
</div>

</div>

Still doesn't work though.

#3

roel00 - November 1, 2008 - 20:34

I've got the same problem. Really don't know how to fix it... It just can't find a valid template file...

 
 

Drupal is a registered trademark of Dries Buytaert.