addtab is a simple Drupal Module that adds a tab that provides links for adding same content type, ie whenever a content is viewed a tab would appear that would link to creating similar content.
The Create tab that you can see in this page being displayed is basically due to this module.
A drupal module consists primarily of two files .info and .module file.
addtab.info:
<?php
; $Id$ addtab.info,v 1.0 2011/02/20 01:26:00 amitsedai Exp $
name = addtab
description = Creates a new tab in a node view for adding same content type
core = 6.x
?>
addtab.module:
<?php
// $Id$
/**
* @file
* Displays the tab when viewing any content type
*
*/
/**
* Implementation of hook_menu().
*/
function addtab_menu () {
$items = array ();
$items['node/%node/create'] = array (
'title' => 'Create',
'page callback' => 'redirect_to_add_page',
'page arguments' => array(1),
'access callback' => TRUE,
'access arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
return $items;
}
function redirect_to_add_page () {
$node = node_load (arg(1));
drupal_goto ($path = "node/add/" . $node->type);
}
?>