Closed (fixed)
Project:
Drupal core
Version:
6.17
Component:
block.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2007 at 19:14 UTC
Updated:
27 Jul 2010 at 07:18 UTC
I created a module with a block hook. As soon as I do so, all block disappear.
function module_block($op = 'list', $delta = 0, $edit = array()) {
/** ...nothing here... */
}
patch file attached is infact a zip of the module.
| Comment | File | Size | Author |
|---|---|---|---|
| module-test.patch | 604 bytes | kibblewhite |
Comments
Comment #1
nevets commentedThe blank screen suggests you have an error in PHP code. I can not read the patch file so the likely sources are a typo or re-declaring a function name. You might also try calling your module something other than 'module' since there are functions that already start with module.
Comment #2
Paul Adler commentedI have exactly the same issue when I try to use the block hook in a module I am creating. I have tried removing all other optional modules, plus removed all the other code from my module except the declaration of the block hook function and still all my blocks are not visible (they all show up in the lists on the admin block page, but not in the sidebars etc). As soon as I remove the block hook function, all the blocks are visible again. There are no errors in my drupal log files.
I am using Drupal 5.1.
Comment #3
Paul Adler commentedKibble, Try renaming the directory that your theme uses and then enabling this new theme. This appears to work for me - let me know if this fixes your problem. I noticed that the blocks are related to a theme in the block table and this led me to investigating theme related issues.
Comment #4
mCode commentedI had the same problem. In my case, the issue was that I used the same name for the module and for the theme, and for some reason the $sidebar_left content arrives empty in page.tpl.php.
So, the workaround I think is to rename either the theme or the module.
Comment #5
kibblewhite commentedAhhh, 'mCode', yes that works. My module had the same name as the theme I was using and caused a few issues.
Renaming the theme, [or you can do it the other way around] resolved this issue.
How strange, not that it's a big problem, but does anyone know if this is a known issue and getting sorted, thus allowing modules and themes to be named the same?
Thanks people for your replies...
Comment #6
jguffey commentedThis Issue is quite old, just wanted to inform anyone else who finds this like I did,
Seems the problem is still in Drupal 6, and the solution here works in 6 as well as in 5, you cannot name your module and theme the same thing. It broke for me when I implemented hook_block.
Comment #7
bradweikel commentedI opened kibble's attachment, and this is a standard trailing whitespace error.
kibble:
It is unnecessary to close php files with a php closing tag (ie "?>"), and doing so will often cause a WSOD (white screen of death) in Drupal because any whitespace after the closing tag will trigger headers to be returned before Drupal is ready, which then causes a duplicate headers error when Drupal does return its own headers. It's a silly little nuisance, but just don't close your php files that way.
Comment #8
missym commentedYep - same here. Block and module need different names or all the blocks disappear. Sometimes the blocks seem to work fine for a while and then suddenly disappear.
Comment #9
gagarine commentedI confirm if you have a module with the same name than you theme all your blocks become crazy and just disappear. Make me a will why my module with just a simple hook_block didn't work.
Comment #10
grendzy commented