A Quick and Easy Basic Custom Module

NOTE: This post describes the very simple process of starting a custom module. The purpose is to use this as a basis for all other custom modules created in Drupal 6 or Drupal 7.

Creating module files

  1. Create/Upload a new folder in you drupal's sites/all/modules/ folder named custom_example
  2. Create/Upload two new files in that folder: the first named custom_example.info, and the second named custom_example.module
  3. Take a moment to notice that the module's folder name and file names are the same.

Now edit the custom_example.info file, and make it's contents the following:


name = Custom Example
description = Just a simple example module
version = 0.1
core = 7.x
package = Alpha Custom Modules

Save/Upload that file.
Drupal 6 note: If you're doing this in drupal 6, change the 'core' number to 6.x

Next, edit the custom_example.module file and make it's contents the follow:


<?php

Thats it! Save/Upload that file and then visit your site's module page.

On your site's module page, you should now be able to see and enable the module (it's in the "Alpha Custom Modules" section).