Sunday, May 8, 2011

How to make a custom Simple module to show your static data in Drupal



Drupal is totally based  on module   I am also  studying module and trying to implement module .
 Here  I am describing the  custom module how to show your  data by module .
 For this you first have to make the  the  file  for module  info  .  I  am  making  it  by my name   vikas.info 

And put your module information on it by the following format

;$Id$
name = "Vikas  module"
description = "this is fist vikas fisrst module"
core = 6.x
php = 5.1

Remember  always  save your custom  module in  site/all/module/

After making  vikas.info  file  save it on above location in folder vikas
Now you have to  make  file for the module  data  now  name the new file
As  vikas.module   and put the following data  in it

<?php
// $Id$
/**
 * @file
 * Module for fetching data from Goodreads.com.
 * This module provides block content retrieved from a
 * Goodreads.com bookshelf.
 * @see http://www.goodreads.com
 */
 /**
 * Implementation of hook_block()
 */
function vikas_block($op='list', $delta=0, $edit=array()) {
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Goodreads Bookshelf');
      return $blocks;
    case 'view':
      $blocks['subject'] = t('vikas');
      $blocks['content'] = t('hello  world ');
      return $blocks;
  }
}
Now   you  static module  I studied it from book and  for good read so not  changing the info
 Now go to your drupal admin  panel   and activate the module and from the block select the option for the  block where you want to display   .this module is compatible with drupal 6.x version

1 comment:

  1. women: can't live with them, pass the beer nuts.

    - http://leads-for-less.blogspot.com/

    ReplyDelete