Create your first simple Drupal 7 module

Create your first Drupal 7 module with the following steps.

  1. Create a folder called helloworld in sites/all/modules/custom
  2. Create a file
  3. Create a template file page-helloworld.tpl.php in your theme directory
  4. Enable your module at
  5. Visit

This belongs into your file

; $Id$

name = helloworld

description = Reinholds Hello World module
package = Reinholds modules
core = 7.x

files[] = helloworld.module

The helloworld.module file

	function helloworld_menu(){

	  $items = array();

	  $items['helloworld'] = array(

	    'title'            => t('Hello world'),
	    'page callback'    => 'helloworld_output',

	    'access arguments' => array('access content'),

	  return $items;


	* Display output
	function helloworld_output() {
	  header('Content-type: text/plain; charset=UTF-8');

	  header('Content-Disposition: inline');
	  return 'helloworld';

The theme template file page-helloworld.tpl.php

print $content;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s