SlideShare a Scribd company logo
Well Come to all of you in Drupal (CMS) Session . Developed By. Kunal Guide by: Amit What is Drupal? Drupal is used to build web sites. It’s a highly modular, open source web content management framework Last Updated: October 17 2007
Generally there are four types of files in drupal we used. These files extension are 1) .CSS 2) .Info 3) .Install 4) .Module Shortly introduction about above files. 1) .Css :-> Use of css files for change the layout of that perticular module. 2) .Info :-> This file is like the .ini file in windows.  the concept of a .info file has been introduced to give Drupal a little more information about your module. 3) .Module :-> Total Functionality about your module. Last Updated: October 17 2007
MODULES:   Drupal is a truly modular framework. Functionality is included in modules, which can be enabled or disabled (some required modules cannot be disabled). Features are added to a Drupal web site by enabling existing modules, installing modules written by members of the Drupal community,or writing new modules. Drupal makes use of the inversion of control design pattern, in which modular functionality is called by the framework at the appropriate time. These opportunities for modules to do their thing are called hooks. Hooks: Hooks can be thought of as internal Drupal events. They are also called callbacks, though because they are constructed by function naming conventions and not by registering with a listener, they are not truly being called back. Hooks allow modules to “hook into” what is happening in the rest of Drupal.Suppose a user logs into your Drupal web site. At the time the user logs in, Drupal fires the user hook. That means that any function named according to the convention module name plus hook name will be called. Blocks: A block is information that can be enabled or disabled in a specific location on your web site’s template. For example, a block might display the number of current active users on your site.You might have a block containing the most active users, or a list of upcoming events. Blocks are typically placed in a template’s sidebar, header, or footer. Blocks can be set to display on nodes of a certain type, only on the front page, or according to other criteria. Last Updated: October 17 2007
.Info :->   This file is like the .ini file in windows.  the concept of a .info file has been introduced to give Drupal a little more information about your module.This file is used  primarily by the modules administration system for display purposes as well as providing criteria to control activation and deactivation. This file is required for Drupal 5 to recognize the presence of a module.The .info file should have the same name as the .module file and reside in the same directory. For example, if your module is named example.module then your .info file should be named example.info.info files may contain comments. The comment character is the semi-colon and denotes a comment until the end of the line. A comment may begin at any point on the line, thus it is especially important you quote any string that contains a comment. It is typical to place the CVS Id at the top of a .info file using a comment: The .info file can contain the following fields:  A) name (Required):   The displayed name of your module. It should follow the Drupal 5 capitalization standard: only the first letter of the first word is capitalized  Ex. name = &quot;Forum&quot; B) description (Required) :  A short, preferably one line description that will tell the administrator what this  module does on the module administration page. Remember, overly long descriptions can make this page difficult to work with, so please try to be concise. This field is limited to 255 characters.Ex. description = &quot;Enables threaded discussions about general topics.“ If your .info file's description (or other field) contains characters other than alphanumeric values then you must quote the string. If you need to use &quot; in the string then you need to use the &quot; value to display the &quot; character.For example, this will display correctly: description = &quot;This is my &quot;crazy@email.com&quot; email address“ This is wrong and cause Drupal to display an error when going to the modules menu:description = This is my &quot;crazy@email.com&quot; address <- DO NOT DO THIS Last Updated: October 17 2007 Next Page Next Page
C) dependencies (Optional):    A space separated list of other modules that your module requires. If these modules are not present, your module can not be enabled. If these modules are present but not enabled, the administrator will be prompted with a list of additional modules to enable and may choose to enable the required modules as well, or cancel at that point. Ex. dependencies = taxonomy comment D) package (Optional):  If your module comes with other modules or is meant to be used exclusively with other modules, enter the name of the package here. If left blank, the module will be listed as 'Other'.  Ex. package = Views  Suggested examples of appropriate items for the package field: 1) Chat 2) Location 3) View 4) Event 5) Video E) version (Optional): Display the version of your modules. Ex. version = 1.1 F) project (packaging use only):  Module maintainers should not use this at all. The packaging script on drupal.org will automatically place a string here to identify what project the module came from. This is primarily for the Update status module, so that Drupal installations can monitor versions of installed packages and notify administrators when new versions are available. Last Updated: October 17 2007
3) .Install :-> .install files to do module setup work. A .install file is run the first time a module is enabled, and is used to do setup required  by the module. The most common task is creating database tables and fields . .install files are also used to perform updates when a new version of a module needs it. There are three functions in .install files. 1) _install() 2) _Update_x() 3) _Uninstall() Use of _install() function is to install the or create the tables in your database. There are two types of labraries/Packages are used by Drupal. These are MySqli & PgSql Note about already installed modules If the module you are writing the .install file for is already installed then the install/update(s) will not trigger even if you disable/enable it. You need to disable the module and remove its record manually form the system table or include a hook_uninstall function. Last Updated: October 17 2007 Next Page Next Page
Syntax For _Install(): function xyz_install() { switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': db_query(&quot;CREATE TABLE {xyz_data} ( vid int unsigned NOT NULL default '0', field_name varchar(32) NOT NULL default '')); break; case 'pgsql': db_query(&quot;CREATE TABLE {xyz_data} ( vid serial CHECK (vid >= 0), field_name varchar(32) NOT NULL default '')); db_query(&quot;CREATE INDEX {xyz_data}_field_name_idx ON {xyz_data} (field_name)&quot;); break; } } Last Updated: October 17 2007 Next Page Next Page
use of _update_x(): .install files can also include update instructions, which are used through update.php like regular Drupal updates. Each update is placed in a modulename_update_x() function (where x is an incrementing integer). Updates should always increment by 1. Syntax For _update_x(): function example_update_1() { $items = array(); $items[] = update_sql(&quot;ALTER TABLE {example} ADD new_column text&quot;); $items[] = update_sql(&quot;ALTER TABLE {example} DROP old_column&quot;); return $items; } Last Updated: October 17 2007 Next Page Next Page
The _uninstall function is also available in a .install file and gets fired when a module is  uninstalled.  This function generally includes dropping tables and deleting variables specific to that module. Syntax _uninstall(): function search_uninstall() { db_query('DROP TABLE {xyz_data}'); db_query('DROP TABLE {xyz_index}'); db_query('DROP TABLE {search_total}'); variable_del('minimum_word_size'); variable_del('overlap_cjk'); } Last Updated: October 17 2007 Next Page Next Page
In Your .Module files you use the hook’s as a function name. suppose _help is the name of your hook then the name of function should be xyz_help() And the xyz is name of your module. There are certain rules while writing the modules. Last Updated: October 17 2007
It is an Practical implementations  so I will show you one module practically. (.Module) File Last Updated: October 17 2007
Pune It Labs. Last Updated: October 17 2007 Thank You Any Questions?
Ad

Recommended

Deployment with ExpressionEngine
Deployment with ExpressionEngine
Green Egg Media
 
Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)
than sare
 
Oracle11g notes
Oracle11g notes
Manish Mudhliyar
 
Drupal Theme Development
Drupal Theme Development
Web Development Montreal
 
PiBase Updates
PiBase Updates
schmutt
 
php
php
tutorialsruby
 
Custom module and theme development in Drupal7
Custom module and theme development in Drupal7
marif4pk
 
Oracle DBA interview_questions
Oracle DBA interview_questions
Naveen P
 
香港六合彩
香港六合彩
iewsxc
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
than sare
 
R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27
zeesniper
 
Sqlmap
Sqlmap
Rushikesh Kulkarni
 
20100622 e z_find_slides_gig_v2.1
20100622 e z_find_slides_gig_v2.1
Gilles Guirand
 
plsql Les05
plsql Les05
sasa_eldoby
 
My sql with querys
My sql with querys
NIRMAL FELIX
 
Java 7 Features and Enhancements
Java 7 Features and Enhancements
Gagan Agrawal
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10
zeesniper
 
Mysql ppt
Mysql ppt
Sanmuga Nathan
 
Formats
Formats
Lee Dohyup
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05
zeesniper
 
R12 d49656 gc10-apps dba 12
R12 d49656 gc10-apps dba 12
zeesniper
 
Sqlmap
Sqlmap
Institute of Information Security (IIS)
 
plsql les03
plsql les03
sasa_eldoby
 
All Oracle-dba-interview-questions
All Oracle-dba-interview-questions
Naveen P
 
DBA 3 year Interview Questions
DBA 3 year Interview Questions
Naveen P
 
Power shell
Power shell
Rajkiran Swain
 
R12 d49656 gc10-apps dba 18
R12 d49656 gc10-apps dba 18
zeesniper
 
JQuery: Introduction
JQuery: Introduction
Amit Kumar Singh
 
Katas, Contests and Coding Dojos
Katas, Contests and Coding Dojos
Kerry Buckley
 
DRUPAL Menu System
DRUPAL Menu System
Amit Kumar Singh
 

More Related Content

What's hot (19)

香港六合彩
香港六合彩
iewsxc
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
than sare
 
R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27
zeesniper
 
Sqlmap
Sqlmap
Rushikesh Kulkarni
 
20100622 e z_find_slides_gig_v2.1
20100622 e z_find_slides_gig_v2.1
Gilles Guirand
 
plsql Les05
plsql Les05
sasa_eldoby
 
My sql with querys
My sql with querys
NIRMAL FELIX
 
Java 7 Features and Enhancements
Java 7 Features and Enhancements
Gagan Agrawal
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10
zeesniper
 
Mysql ppt
Mysql ppt
Sanmuga Nathan
 
Formats
Formats
Lee Dohyup
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05
zeesniper
 
R12 d49656 gc10-apps dba 12
R12 d49656 gc10-apps dba 12
zeesniper
 
Sqlmap
Sqlmap
Institute of Information Security (IIS)
 
plsql les03
plsql les03
sasa_eldoby
 
All Oracle-dba-interview-questions
All Oracle-dba-interview-questions
Naveen P
 
DBA 3 year Interview Questions
DBA 3 year Interview Questions
Naveen P
 
Power shell
Power shell
Rajkiran Swain
 
R12 d49656 gc10-apps dba 18
R12 d49656 gc10-apps dba 18
zeesniper
 
香港六合彩
香港六合彩
iewsxc
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
than sare
 
R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27
zeesniper
 
20100622 e z_find_slides_gig_v2.1
20100622 e z_find_slides_gig_v2.1
Gilles Guirand
 
My sql with querys
My sql with querys
NIRMAL FELIX
 
Java 7 Features and Enhancements
Java 7 Features and Enhancements
Gagan Agrawal
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10
zeesniper
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05
zeesniper
 
R12 d49656 gc10-apps dba 12
R12 d49656 gc10-apps dba 12
zeesniper
 
All Oracle-dba-interview-questions
All Oracle-dba-interview-questions
Naveen P
 
DBA 3 year Interview Questions
DBA 3 year Interview Questions
Naveen P
 
R12 d49656 gc10-apps dba 18
R12 d49656 gc10-apps dba 18
zeesniper
 

Viewers also liked (6)

JQuery: Introduction
JQuery: Introduction
Amit Kumar Singh
 
Katas, Contests and Coding Dojos
Katas, Contests and Coding Dojos
Kerry Buckley
 
DRUPAL Menu System
DRUPAL Menu System
Amit Kumar Singh
 
Getting Started With Php Frameworks @BCP5
Getting Started With Php Frameworks @BCP5
Amit Kumar Singh
 
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
 
Inovação Aberta - Open Innovation
Inovação Aberta - Open Innovation
gcm
 
Katas, Contests and Coding Dojos
Katas, Contests and Coding Dojos
Kerry Buckley
 
Getting Started With Php Frameworks @BCP5
Getting Started With Php Frameworks @BCP5
Amit Kumar Singh
 
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
 
Inovação Aberta - Open Innovation
Inovação Aberta - Open Innovation
gcm
 
Ad

Similar to Drupal Modules (20)

Drupal
Drupal
Rightway Solution (I) Pvt. Ltd
 
Drupal module development
Drupal module development
Rachit Gupta
 
Intro to drupal module internals asheville
Intro to drupal module internals asheville
cgmonroe
 
Creating Drupal A Module
Creating Drupal A Module
arcaneadam
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
Dhinakaran Mani
 
Intro to Drupal Module Developement
Intro to Drupal Module Developement
Matt Mendonca
 
2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood
James Walker
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
Why Drupal is Rockstar?
Why Drupal is Rockstar?
Gerald Villorente
 
Introduction to Drupal Basics
Introduction to Drupal Basics
Juha Niemi
 
Introduction To Drupal
Introduction To Drupal
Lauren Roth
 
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
DrupalMumbai
 
SynapseIndia drupal presentation on drupal
SynapseIndia drupal presentation on drupal
Synapseindiappsdevelopment
 
Drupal Coding Standards - do and don't
Drupal Coding Standards - do and don't
Arunkumar Kupppuswamy
 
Drupal6 and Drupal 7 difference
Drupal6 and Drupal 7 difference
Kanagaraj Chinnadurai
 
Modules Building Presentation
Modules Building Presentation
htyson
 
Drupal module development
Drupal module development
Damjan Cvetan
 
An Introduction to Drupal & How to Use It by Sanket Jain
An Introduction to Drupal & How to Use It by Sanket Jain
Innoraft
 
Drupal Module Development
Drupal Module Development
ipsitamishra
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
Siva Epari
 
Drupal module development
Drupal module development
Rachit Gupta
 
Intro to drupal module internals asheville
Intro to drupal module internals asheville
cgmonroe
 
Creating Drupal A Module
Creating Drupal A Module
arcaneadam
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
Dhinakaran Mani
 
Intro to Drupal Module Developement
Intro to Drupal Module Developement
Matt Mendonca
 
2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood
James Walker
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
Introduction to Drupal Basics
Introduction to Drupal Basics
Juha Niemi
 
Introduction To Drupal
Introduction To Drupal
Lauren Roth
 
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
DrupalMumbai
 
Drupal Coding Standards - do and don't
Drupal Coding Standards - do and don't
Arunkumar Kupppuswamy
 
Modules Building Presentation
Modules Building Presentation
htyson
 
Drupal module development
Drupal module development
Damjan Cvetan
 
An Introduction to Drupal & How to Use It by Sanket Jain
An Introduction to Drupal & How to Use It by Sanket Jain
Innoraft
 
Drupal Module Development
Drupal Module Development
ipsitamishra
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
Siva Epari
 
Ad

More from Amit Kumar Singh (20)

Improving Core Web Vitals for WordPress
Improving Core Web Vitals for WordPress
Amit Kumar Singh
 
Getting started with WordPress Development
Getting started with WordPress Development
Amit Kumar Singh
 
Alternate Development Techniques on WordPress
Alternate Development Techniques on WordPress
Amit Kumar Singh
 
Building Minimal Viable Product (MVP) with WordPress
Building Minimal Viable Product (MVP) with WordPress
Amit Kumar Singh
 
Rapid Prototyping With WordPress
Rapid Prototyping With WordPress
Amit Kumar Singh
 
Stop Coding; Start Assembling Your Websites
Stop Coding; Start Assembling Your Websites
Amit Kumar Singh
 
WordPress as Rapid Prototyping Tool
WordPress as Rapid Prototyping Tool
Amit Kumar Singh
 
WordPress Use Cases
WordPress Use Cases
Amit Kumar Singh
 
Leveraging your business with WordPress
Leveraging your business with WordPress
Amit Kumar Singh
 
Maharashtra at a glance
Maharashtra at a glance
Amit Kumar Singh
 
Custom Post Type and Taxonomies in WordPress 3.x
Custom Post Type and Taxonomies in WordPress 3.x
Amit Kumar Singh
 
WPoid : You Blog, We Take Care Of The Rest
WPoid : You Blog, We Take Care Of The Rest
Amit Kumar Singh
 
Joomla Request To Response
Joomla Request To Response
Amit Kumar Singh
 
Introduction to web services and how to in php
Introduction to web services and how to in php
Amit Kumar Singh
 
Php Security
Php Security
Amit Kumar Singh
 
Open Social Phpcamp
Open Social Phpcamp
Amit Kumar Singh
 
Overview Of Drupal
Overview Of Drupal
Amit Kumar Singh
 
PHP tips by a MYSQL DBA
PHP tips by a MYSQL DBA
Amit Kumar Singh
 
Joomla @ Barcamp4(Feb 08 Pune)
Joomla @ Barcamp4(Feb 08 Pune)
Amit Kumar Singh
 
Tables And SQL basics
Tables And SQL basics
Amit Kumar Singh
 
Improving Core Web Vitals for WordPress
Improving Core Web Vitals for WordPress
Amit Kumar Singh
 
Getting started with WordPress Development
Getting started with WordPress Development
Amit Kumar Singh
 
Alternate Development Techniques on WordPress
Alternate Development Techniques on WordPress
Amit Kumar Singh
 
Building Minimal Viable Product (MVP) with WordPress
Building Minimal Viable Product (MVP) with WordPress
Amit Kumar Singh
 
Rapid Prototyping With WordPress
Rapid Prototyping With WordPress
Amit Kumar Singh
 
Stop Coding; Start Assembling Your Websites
Stop Coding; Start Assembling Your Websites
Amit Kumar Singh
 
WordPress as Rapid Prototyping Tool
WordPress as Rapid Prototyping Tool
Amit Kumar Singh
 
Leveraging your business with WordPress
Leveraging your business with WordPress
Amit Kumar Singh
 
Custom Post Type and Taxonomies in WordPress 3.x
Custom Post Type and Taxonomies in WordPress 3.x
Amit Kumar Singh
 
WPoid : You Blog, We Take Care Of The Rest
WPoid : You Blog, We Take Care Of The Rest
Amit Kumar Singh
 
Joomla Request To Response
Joomla Request To Response
Amit Kumar Singh
 
Introduction to web services and how to in php
Introduction to web services and how to in php
Amit Kumar Singh
 
Joomla @ Barcamp4(Feb 08 Pune)
Joomla @ Barcamp4(Feb 08 Pune)
Amit Kumar Singh
 

Recently uploaded (20)

The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 

Drupal Modules

  • 1. Well Come to all of you in Drupal (CMS) Session . Developed By. Kunal Guide by: Amit What is Drupal? Drupal is used to build web sites. It’s a highly modular, open source web content management framework Last Updated: October 17 2007
  • 2. Generally there are four types of files in drupal we used. These files extension are 1) .CSS 2) .Info 3) .Install 4) .Module Shortly introduction about above files. 1) .Css :-> Use of css files for change the layout of that perticular module. 2) .Info :-> This file is like the .ini file in windows. the concept of a .info file has been introduced to give Drupal a little more information about your module. 3) .Module :-> Total Functionality about your module. Last Updated: October 17 2007
  • 3. MODULES: Drupal is a truly modular framework. Functionality is included in modules, which can be enabled or disabled (some required modules cannot be disabled). Features are added to a Drupal web site by enabling existing modules, installing modules written by members of the Drupal community,or writing new modules. Drupal makes use of the inversion of control design pattern, in which modular functionality is called by the framework at the appropriate time. These opportunities for modules to do their thing are called hooks. Hooks: Hooks can be thought of as internal Drupal events. They are also called callbacks, though because they are constructed by function naming conventions and not by registering with a listener, they are not truly being called back. Hooks allow modules to “hook into” what is happening in the rest of Drupal.Suppose a user logs into your Drupal web site. At the time the user logs in, Drupal fires the user hook. That means that any function named according to the convention module name plus hook name will be called. Blocks: A block is information that can be enabled or disabled in a specific location on your web site’s template. For example, a block might display the number of current active users on your site.You might have a block containing the most active users, or a list of upcoming events. Blocks are typically placed in a template’s sidebar, header, or footer. Blocks can be set to display on nodes of a certain type, only on the front page, or according to other criteria. Last Updated: October 17 2007
  • 4. .Info :-> This file is like the .ini file in windows. the concept of a .info file has been introduced to give Drupal a little more information about your module.This file is used primarily by the modules administration system for display purposes as well as providing criteria to control activation and deactivation. This file is required for Drupal 5 to recognize the presence of a module.The .info file should have the same name as the .module file and reside in the same directory. For example, if your module is named example.module then your .info file should be named example.info.info files may contain comments. The comment character is the semi-colon and denotes a comment until the end of the line. A comment may begin at any point on the line, thus it is especially important you quote any string that contains a comment. It is typical to place the CVS Id at the top of a .info file using a comment: The .info file can contain the following fields: A) name (Required): The displayed name of your module. It should follow the Drupal 5 capitalization standard: only the first letter of the first word is capitalized Ex. name = &quot;Forum&quot; B) description (Required) : A short, preferably one line description that will tell the administrator what this module does on the module administration page. Remember, overly long descriptions can make this page difficult to work with, so please try to be concise. This field is limited to 255 characters.Ex. description = &quot;Enables threaded discussions about general topics.“ If your .info file's description (or other field) contains characters other than alphanumeric values then you must quote the string. If you need to use &quot; in the string then you need to use the &quot; value to display the &quot; character.For example, this will display correctly: description = &quot;This is my &quot;[email protected]&quot; email address“ This is wrong and cause Drupal to display an error when going to the modules menu:description = This is my &quot;[email protected]&quot; address <- DO NOT DO THIS Last Updated: October 17 2007 Next Page Next Page
  • 5. C) dependencies (Optional): A space separated list of other modules that your module requires. If these modules are not present, your module can not be enabled. If these modules are present but not enabled, the administrator will be prompted with a list of additional modules to enable and may choose to enable the required modules as well, or cancel at that point. Ex. dependencies = taxonomy comment D) package (Optional): If your module comes with other modules or is meant to be used exclusively with other modules, enter the name of the package here. If left blank, the module will be listed as 'Other'. Ex. package = Views Suggested examples of appropriate items for the package field: 1) Chat 2) Location 3) View 4) Event 5) Video E) version (Optional): Display the version of your modules. Ex. version = 1.1 F) project (packaging use only): Module maintainers should not use this at all. The packaging script on drupal.org will automatically place a string here to identify what project the module came from. This is primarily for the Update status module, so that Drupal installations can monitor versions of installed packages and notify administrators when new versions are available. Last Updated: October 17 2007
  • 6. 3) .Install :-> .install files to do module setup work. A .install file is run the first time a module is enabled, and is used to do setup required by the module. The most common task is creating database tables and fields . .install files are also used to perform updates when a new version of a module needs it. There are three functions in .install files. 1) _install() 2) _Update_x() 3) _Uninstall() Use of _install() function is to install the or create the tables in your database. There are two types of labraries/Packages are used by Drupal. These are MySqli & PgSql Note about already installed modules If the module you are writing the .install file for is already installed then the install/update(s) will not trigger even if you disable/enable it. You need to disable the module and remove its record manually form the system table or include a hook_uninstall function. Last Updated: October 17 2007 Next Page Next Page
  • 7. Syntax For _Install(): function xyz_install() { switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': db_query(&quot;CREATE TABLE {xyz_data} ( vid int unsigned NOT NULL default '0', field_name varchar(32) NOT NULL default '')); break; case 'pgsql': db_query(&quot;CREATE TABLE {xyz_data} ( vid serial CHECK (vid >= 0), field_name varchar(32) NOT NULL default '')); db_query(&quot;CREATE INDEX {xyz_data}_field_name_idx ON {xyz_data} (field_name)&quot;); break; } } Last Updated: October 17 2007 Next Page Next Page
  • 8. use of _update_x(): .install files can also include update instructions, which are used through update.php like regular Drupal updates. Each update is placed in a modulename_update_x() function (where x is an incrementing integer). Updates should always increment by 1. Syntax For _update_x(): function example_update_1() { $items = array(); $items[] = update_sql(&quot;ALTER TABLE {example} ADD new_column text&quot;); $items[] = update_sql(&quot;ALTER TABLE {example} DROP old_column&quot;); return $items; } Last Updated: October 17 2007 Next Page Next Page
  • 9. The _uninstall function is also available in a .install file and gets fired when a module is uninstalled. This function generally includes dropping tables and deleting variables specific to that module. Syntax _uninstall(): function search_uninstall() { db_query('DROP TABLE {xyz_data}'); db_query('DROP TABLE {xyz_index}'); db_query('DROP TABLE {search_total}'); variable_del('minimum_word_size'); variable_del('overlap_cjk'); } Last Updated: October 17 2007 Next Page Next Page
  • 10. In Your .Module files you use the hook’s as a function name. suppose _help is the name of your hook then the name of function should be xyz_help() And the xyz is name of your module. There are certain rules while writing the modules. Last Updated: October 17 2007
  • 11. It is an Practical implementations so I will show you one module practically. (.Module) File Last Updated: October 17 2007
  • 12. Pune It Labs. Last Updated: October 17 2007 Thank You Any Questions?

Editor's Notes

  • #2: Use this template to create Intranet web pages for your workgroup or project. You can modify the sample content to add your own information, and you can even change the structure of the web site by adding and removing slides. The navigation controls are on the slide master. To change them, on the View menu, point to Master , then choose Slide Master . To add or remove hyperlinks on text or objects, or to change existing hyperlinks, select the text or object, then choose Hyperlink from the Insert menu. When you’re finished customizing, delete these notes to save space in your final HTML files. For more information, ask the Answer Wizard about: The Slide Master Hyperlinks