Friday, May 11, 2012

How to create weather module?

Required modules: weather module


Steps to create:
1. Copy weather folder to your sites/all/modules directory.
2. At  Administer -> Site building -> Modules (admin/build/modules) enable the module.
3. Configure the module settings at
  Administer -> Site configuration -> weather (admin/settings/weather).
4. Configure the Nice Menus block at
  Administer -> Site building -> Blocks (admin/build/block), setting the weather and display style, etc.
5. Return to the blocks page and enable the weather block(s), e.g. 'system-   wide' by putting it in a region.

Monday, May 7, 2012

How to create nicemenus?


Steps to create:
1. Copy nice_modules folder to your sites/all/modules directory.
2. At  Administer -> Site building -> Modules (admin/build/modules) enable the module.
3. Configure the module settings at
  Administer -> Site configuration -> Nice Menus (admin/settings/nice_menus).
4. Configure the Nice Menus block at
  Administer -> Site building -> Blocks (admin/build/block), setting the source menu and menu style, etc.
5. Return to the blocks page and enable the Nice menus block(s), e.g. 'Nice Menu 1 (Nice Menu)' by putting it in a region.

how to create Taxonomy?


Steps to create:
1.Enable the cck module
2. open the taxonomy
Administer - Content Management - Taxonomy
3. Add the new vocabulary
 Administer - Content Management - Taxonomy ->add vocabulary
Here you have to mention where these taxonomy will show/ used.
4. Finally add the items to our new vocabulary
Content management->Taxonomy->New vocabulary->add items

how to create new content types?


Required modules:
1.CCk
Steps to create:
1.Enable the cck module
2.Create the content type with one name which you need. Like my details
Administer - Content Management - add content type
3.Open contenet types and manage the fields. Ie: here we add the contents which needed for our requirement.
 Administer - Content Management - My Details ->manage fields
4. create content for the our custom content type.
Home-> create content-> My details->

Saturday, May 5, 2012

Modules classification?


A Drupal site can have three kinds of modules (the 3 Cs):
  1. Core modules that ship with Drupal and are approved by the core developers and the community.
  2. Contributed modules written by the Drupal community and shared under the same GNU Public License (GPL) as Drupal.
  3. Custom modules created by the developer of the website.

Creation of Hello World module in Drupal 6


1. Create a folder for your module
Create a folder in your modules directory called helloworld ie sites/all/modules/helloworld/. It is good practice to put all custom modules in sites/all/modules/ folder and not the modules/ folder. The modulesfolder is meant for core modules any “third party” or custom modules should be in sites/all/modules/.
So now that you’ve created the folder sites/all/modules/helloworld/
2. Create the *.info file
Create a file called modulename.info in this case helloworld.info
?
1
2
3
4
; $Id$
name = Hello World Module
description = My very first Drupal Module
core = 6.x
This lets Drupal know about your module
3. Create the *.module file
Create a file called modulename.module in this case helloworld.module
We need to let Drupal know what path the module will be accessible from. We do this by using thehook_menu() hook. To implement  hooks follow the following convention: modulename_hookname(). So for our module we must create a function called helloworld_menu(). More info here .
?
1
2
3
4
5
6
7
8
9
10
11
function helloworld_menu(){
$items = array();
$items['helloworld'] = array(
'title' => t('Welcome to the Hello World Module'),
'page callback' => 'helloworld_page',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
  );
  return $items;
}
Break Down
We created $items['helloworld'] array item. This lets drupal know about the path we want to use for our module.
title: this is what gets printed at the top of the page. The page title.
page callback: This is the function that gets called when the url is accesed.
page arguments: must be array of arguments that get parsed to the call back function, not required.
access arguments: array of access permissions in this case any role with ‘access content’ permissions can access the page.
type: specifies the menu type check hook_menu()  for more details the Drupal hook.

So in a nutshell, when Drupal hits the http://mysite.com/helloworld url it will look for a call back function called helloworld_page(). Simple Enough. Now lets create the helloworld_page() function.
?
1
2
3
function helloworld_page($argument) {
   return "Hello World!";
}
So your helloworld.module file will contain:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
function helloworld_menu(){
$items = array();
$items['helloworld'] = array(
'title' => t('Welcome to the Hello World Module'),
'page callback' => 'helloworld_page',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
  );
  return $items;
}
function helloworld_page($argument) {
    return "Hello World! Arguments parsed was " . $argument;
}