How to create several different blocks in one module in Drupal 6?

I use hook_block to create a block with the name of the custom module that I am creating.
I cannot create a block without using myModuleName_block.

Do I need to make different modules for each individual block that I want to create?

+7
php drupal drupal-6 drupal-blocks
source share
1 answer

You can make multiple blocks with hook_block , just use $delta .

 function hook_block($op = 'list', $delta = 0, $edit = array()) { switch ($op) { case 'list': $blocks[0]['info'] = t('Block 1'); $blocks[1]['info'] = t('Block 2'); return $blocks; case 'configure': if ($delta == 0) { // Block 1 } else if ($delta == 1) { // Block 1 } .... } 
+15
source share

All Articles