Begin:
- Go to 'modules' of drupal 7.
- Create 'hello_world' folder.
- Create two blank files: hello_world.info and hello_world.module under 'hello_world' under 'hello_world' folder.
- Open 'hello_world.info' and enter this content:
name = Hello World
description = This is my first module
core = 7.x - Go to 'Modules' at back-end, You will see your module listed here. Don't enable this module, because we still not finish yet.
- Create a menu link to call a page where will show 'hello world'. Open 'hello_world.module' and enter this content:
function hello_world_menu() {
$items['hello-world'] = array(
'title' => 'Hello World',
'page callback' => 'hello_world',
'access arguments' => array('access content'),
);
return $items;
}
function hello_world() {
return "hello world";
} - Go to home page and the result will look like this: