Hi all -

I thought it about time I write a module for a site I'm working on instead of writing code into the .tpl.php files.

I've got my module working fine - I've created a block to show a list of recent content that matches a set of parameters. (Unfortunately "views" module couldn't provide me with what I wanted.)

I'd like to be able to re-use this module code and set up a number of different blocks by passing in different parameters to it. Is this possible or do I need to create a different module for each block? What is best practice here?

Many thanks!
Rachel

Comments

budda’s picture

Your module to display multiple blocks from the same hook_block() function. It uses arrays to tell Drupal about the blocks it can display.

http://api.drupal.org/api/HEAD/function/hook_block probably has the best code for showing how to define multiple blocks in a single module.

--
Ixis (UK) providing Drupal consultancy and Drupal theme design.