bharani kumar wrote:
Dears i want to use the two blocks in a single module this is my code ,
in 2 block are displayed in the blocks setting place,
i enable both , its not displaying,
Any idea..
<?php // $Id$ /**
- Implementation of hook_block().
- Displays the most recent (x) blog titles on the user profile page.
(x) is set in block configuration admin section. */ function ptHeadlines_block($op = 'list', $delta = 0, $edit = array()) { global $user; switch ($op) { case 'list': $block[0]['info'] = t('More Headline '); $block[0]['title'] = t('More Headline ');
$block[1]['info'] = t('Top Headline'); $block[1]['title'] = t('Top Headline');
Here you are defining $delta. The "More Headline" block is $delta == 0, and the "Top Headline" block is $delta ==1
[snip] //this is block for top Headlines
if (user_access('access content') && $delta == 0 &&arg(0)=='user') {
You need to change this line to check for $delta == 1
A more common approach for the 'view' operation is to use a switch on $delta:
switch ($delta) { case 0: // do stuff for first block break; case 1: // do stuff for second block break;
} return $block;
Cheers,
Jonathan