- a .info file
- an other file (.php, .inc ?)
To choose a name for you module, don't forget those basic rules :
- no capital letter
- no special character (excepted _ underscore)
Your first .info file
A .info is in fact a your_module_name.info file.Let's make in your example a drupal_test module.
name (mandatory)
The name of your module (with capital letters and spaces this time, if you want)
name = Drupal Test Module
description (recommended)
description = A super duper test module !
core (mandatory)
core = 7.x
files[]
The location of your (php ?) filesfiles[] = inc/example.php
The whole .info file
For Drupal 7, you can find all informations about .info files here:name =
Drupal Test Module
description = Provides a really neat widget for your site's sidebar.
core = 7.x
files[] =
inc/example.php
https://drupal.org/node/542202
Now the example.php file
You can now edit your php file, located in /sites/all/modules/drupal_test/inc/example.phpWe will make a simple "Hello World" test. We will
- make a menu link (make shortcut like http://www.mywebsite.com/drupal_test/mylink)
- create a basic content (your "Hello World")
This part redirects http://www.mywebsite.com/drupal_test/mylink to your website, and calls thefunction
drupal_test_menu() { $items['
drupal_test/mylink'] = array( 'page callback' => 'drupal_test_hello_world', ); return $items; }
drupal_test_hello_world()
function.That's it !function
return array( '#markup' => '<p>Hello world</p>', );
drupal_test_hello_world
() {}
If you have questions, i'll try to answer you. Do not hesitate to leave comments.