I have created a new module using the hooks of block_info() and block_view().

This is what the code is :-

Nova.info -
=========================================
name = Nova Module
description = "Nova Module with block_info and block_view hooks"
package = Build a Module
core = 7.x
files[] = nova.module
===========================================

nova.module
===========================================
<? php
/**
*Implements hook_block_info()
*/
function nova_block_info()
{
$blocks = array();
$blocks['info'] = array(
'info' => t('Weather Zone'),

);
return $blocks;
}
//Implements hook_block_view()
function nova_block_view($delta = '')
{
$block = array(
'subject' => t('Weather Forecast'),
'content' => 'Its Hot Outside',
);

return $block;
}
=================================================

I have enabled the module and cleared the cache (several times), but, I am not able to see the this block in Admin-> Structure-> Blocks (Disabled) section at all.

I am getting the php code printed on top of my site, but, I am not sure why that's happening.

Any advice/suggestion is welcome.

Thanks.

Comments

gaurav_varshney’s picture

Hi Sub,
1. Can you please confirm that the name of .info file is nova.info instead of Nova.info
2. in nova.module file please use "<?php" instead of "<? php" in you code.
3. you should use the switch case keyed by the $delta in hook_block_view just in case if you are goint to create another block in the module.