Declaring we have block content
Main topic described: A content block
Drupal hook described: hook_block
There are several types of modules: block modules and node modules are two. Block modules create abbreviated content that is typically (but not always, and not required to be) displayed along the left or right side of a page. Node modules generate full page content (such as blog, forum, or book pages).
We'll create a block content to start, and later discuss node content, as well as filtering content. A module can generate content for blocks and also for a full page (the blogs module is a good example of this). The hook for a block module is appropriately called "block", so let's start our next function:
<?php
/**
* Generate HTML for the onthisdate block
* @param op the operation from the URL
* @param delta offset
* @returns block HTML
*/
function onthisdate_block($op='list', $delta=0) {
} // end function onthisdate_block
?>The block function takes two parameters: the operation and the offset, or delta. The offset allows you to create different content for different blocks, all within the same block function. We'll just worry about the operation at this point. In particular, we care about the specific case where the block is being listed in the blocks page. In all other situations, we'll display the block content.
When the module will be listed on the blocks page, the $op parameter's value will be 'list':
<?php
/**
* Generate HTML for the onthisdate block
* @param op the operation from the URL
* @param delta offset
* @returns block HTML
*/
function onthisdate_block($op='list', $delta=0) {
// listing of blocks, such as on the admin/block page
if ($op == "list") {
$block[0]["info"] = t('On This Date');
return $block;
}
} // end onthisdate_block
?>Next, we'll generate the block content.
For more information about the block hook see the hook_block API documentation.

Description of Block info array
You can use the array returned by the "list" operation to set a default configuration for the block. As far as I can tell, the following keys can be set:
module and theme names
I have just discovered a very nasty trap concerning module and theme names.
I am relatively new to drupal and maybe I have missed a warning in the several books and the labyrinthine drupal 5 documentation on this site.
I am working on sorting out a very badly structured project and to make things a bit clearer I introduced a new module named after the project title. The main theme for the site has the same name.
Now I had a very confusing situation where my newly defined block views stopped to work after I added a generalized version of a few blocks to the main module. After several hours of experimenting, I discovered that projectname_block is the module projectname's implementation of hook_block, but also it is the overload for theme('block') for the theme 'projectname'. This is very bad. So don't give the same name to a module and a theme, it will bite you back sooner or later.