[support] Problem with hook_block on Drupal 6.x

Tim Gustafson tjg at soe.ucsc.edu
Fri Sep 3 00:26:08 UTC 2010


Hi,

I've created a module whose sole purpose is to add a few banners to the left region of our sites.  Here's the code I'm using:

function banners_block($op) {
  if ($op == "list") {
    return array(
      "banners" => array(
        "info" => "Banners",
        "cache" => BLOCK_NO_CACHE,
        "weight" => 50,
        "status" => 1,
        "region" => "left",
        "visibility" => 0,
        "pages" => "",
      ),
    );
  } else if ($op == "view") {
    return array(
      "subject" => "<none>",
      "content" => "<p>" . time() . "</p>\n",
    );
  }
}

However, when I activate this module, it does not appear in the blocks configuration page and no content is added to the "left" region.  I've emptied the cache, logged out and back in again, run cron, and nothing appears.  If I put a little debug line like:

echo ".";

right after the 'if ($op == "list") {' line, it does display a period at the top of each page, so I'm sure that the module is being loaded and executed.  It's just not displaying the block anywhere.  If I put a similar debug line after the '$op == "view"' line, no dot gets displayed on any page.

Am I doing something wrong?

Tim Gustafson
Baskin School of Engineering
UC Santa Cruz
tjg at soe.ucsc.edu
831-459-5354



More information about the support mailing list