Sunday, March 23, 2014

How to create a simple custom module in Drupal 7

 follow below the step
Create your first "DataShow" 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-datashow.tpl.php in your theme directory
  4. Enable your module at
  5. Visit
This belongs into your file:
; $Id$
name = DataShow
description = Bikash ranjan Data Show module
package = Bikash ranjan modules
core = 7.x
files[] = datashow.module
The datashow.module file
 function datashow_menu(){
   $items = array();
   $items['helloworld'] = array(
     'title'            => t('Data Show'),
     'page callback'    => 'datashow_output',
     'access arguments' => array('access content'),
   return $items;
 * Display output
 function datashow_output() {
   header('Content-type: text/plain; charset=UTF-8');
   header('Content-Disposition: inline');
   return 'datashow';
The theme template file page-datashow.tpl.php
print $content;

No comments:

Post a Comment