How does Drupal Work? Information Systems 337 Prof. Harry Plantinga.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

A brief overview of Drupal 7 By Robin Isard, Systems Librarian Algoma University.
METALOGIC s o f t w a r e © Metalogic Software Corporation DACS Developer Overview DACS – the Distributed Access Control System.
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG.
Seattle Drupal Clinic Introduction to Drupal and Web Content Management.
PHP and the Web: Session : 4. Predefined variables PHP provides a large number of predefined global variables to any script which it runs also called.
“Drupal is written in PHP, which is uttterly offensive to people.” H o r r i b l e T r u t h 1.
Drupal Online Tutorial A Product of an ENGL 421 class at Purdue University Page 1.
Introduction to Module Development Yi Zhang & Nikki Massaro Kauffman.
1 Chapter 12 Working With Access 2000 on the Internet.
Drupal Create a website/web app quickly with this Content Management System Jiaying Xu Spring 2011 COMS E6125 Web-enHanced Information.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Web Tailor Basics.
Introduction Need: A dynamic, user controlled website Built in forums, security, and news support Work with existing OpenInsight application Seamless.
Justin Klein Keane Drupal Training Session 1 Introduction to Drupal.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Drupal Workshop Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology, Drupal technology, directories.
Walking the walk and talking the talk… T HE L ANGUAGE OF D RUPAL.
CST JavaScript Validating Form Data with JavaScript.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
The Drupal 6 menu system: architecture, do, don't and tricks (part 1) Peter Wolanin August 27, 2008 Drupalcon, Szeged.
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
Drupal Content Management System Mallikarjuna Pinjala CIS 764, Nov
1/30/11 Hacking your way through the Drupal API, a themers intro Baris Wanschers (BarisW)
SCHOOL OF INFORMATION UNIVERSITY OF MICHIGAN si.umich.edu Drupal: Configuration and Customization Week 4: Installation, Module Development January 25,
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Drupal Training Syllabus Chaitanya Lakshmi
How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
Joomla! Reborn: coding in version 1.5. It finally works the way you always wanted Completely overhauled codebase Improved security Better menu and URL.
Entities in Drupal 7 & the Entity API #sudrupalcamp April 6, 2013 JD Leonard ModernBizConsulting.com ModernBizConsulting.com ModernBizConsulting.com.
Content Types and Views Information Systems 337 Prof. Harry Plantinga.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Drupal Jumpstart Information Systems 337 Prof. Harry Plantinga.
Revolutionizing enterprise web development Searching with Solr.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Drupal Commerce Better than Uber Andrew Root: druroot.
CAKEPHP Blog tutorial. what you’ll need examples/blog/blog.html 2  A running web server  A database server.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Proposal for the new group web infrastructure SFT Group meeting 3/7/2009 Yves Perrin.
Drupal Overview Prepared by : Agustin D. Gumogda Jr. Instructor.
Drupal SEO Kristen Pol CruzTech, LLC (Freelance)‏ Web, Drupal & SEO Santa Cruz, CA drupal: kepol.
Friend Connect Integration. WordPress Open source blog engine PHP / MySQL based Completely customizable Plugin friendly.
Forensic Drupal Debugging Dan Harris daneesia on drupal.org.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Introduction to Module Development John Fiala and Ezra Barnett Gildesgame.
Entities in Drupal 7 & the Entity API #sfdug March 11, 2013 JD Leonard ModernBizConsulting.com.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Drush: The Drupal Shell Utility Trevor Mckeown Founder & Owner Sublime Technologies
What's New in Kinetic Calendar 2.0 Jack Boespflug Kinetic Data.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
OO: Geting the Uh-oh’s out of Object Oriented Drupal 8.
Improvement of Apriori Algorithm in Log mining Junghee Jaeho Information and Communications University,
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
I2CE Framework I2CE: Intrahealth Informatics Core Engine Base Web Framework on which iHRIS Manage and iHRIS Qualify are built on: Module Structure Magic.
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
Development and Deployment
Customizing your Theme
Open Source Programming
Establish, configure and maintain a website/system
Presentation transcript:

How does Drupal Work? Information Systems 337 Prof. Harry Plantinga

Drupal Modules Defining a Module: guess how? Defining a Module: guess how? Create a directory, e.g. /sites/all/modules/annotate Create a directory, e.g. /sites/all/modules/annotate Create a file annotate.info : Create a file annotate.info : name = Annotate description = Allows users to annotate nodes. package = Example core = "6.x"

Hooks Module system based on the concept of hooks Module system based on the concept of hooks Hook: Hook: a PHP function named foo_bar() a PHP function named foo_bar() foo: name of the module foo: name of the module bar: name of the hook bar: name of the hook Extending Drupal: Extending Drupal: a module extends Drupal by implementing hooks a module extends Drupal by implementing hooks

Hooks An event happens, e.g. a user logs into the site. An event happens, e.g. a user logs into the site. Drupal fires the "user hook". Drupal fires the "user hook". That means each module's user hook function will be called: That means each module's user hook function will be called: comment_user() comment_user() node_user() node_user() locale_user() locale_user() myCustomModule_user() myCustomModule_user() Documented on Drupal.org Documented on Drupal.orgDrupal.org

Examples Example: hook_access($op, $node, $account) Example: hook_access($op, $node, $account) this hook allows modules to limit access to the node types they define this hook allows modules to limit access to the node types they define $op: create, delete update, view $op: create, delete update, view returns TRUE, FALSE, or NULL (don't override settings in the node_access table returns TRUE, FALSE, or NULL (don't override settings in the node_access table to override in "example" module, you would implement example_access() to override in "example" module, you would implement example_access()

Add a Menu Entry /** * Implementation of hook_menu() * Implementation of hook_menu() */ */ function annotate_menu() { $items['admin/settings/annotate'] = array( $items['admin/settings/annotate'] = array( 'title' => 'Annotation settings', 'title' => 'Annotation settings', 'description' => 'Change how annotations behave', 'description' => 'Change how annotations behave', 'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form', 'page arguments' => array('annotate_admin_settings'), 'page arguments' => array('annotate_admin_settings'), 'access arguments' => array('administer site configuration'), 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM, ); ); return $items; return $items;}

Define Settings Form /** * Define the settings form. * Define the settings form. */ */ function annotate_admin_settings() { $form['annotate_node_types'] = array( $form['annotate_node_types'] = array( '#type' => 'checkboxes', '#type' => 'checkboxes', '#title' => 'Users may annotate these node types' '#title' => 'Users may annotate these node types' '#default_value' => '#default_value' => variable_get('annotate_nodetypes', array('page')), variable_get('annotate_nodetypes', array('page')), '#description' => 'A text field will be available on these node types to make user-specific notes.', '#description' => 'A text field will be available on these node types to make user-specific notes.', ); ); $form['array_filter'] = array('#type' => 'hidden'); $form['array_filter'] = array('#type' => 'hidden'); return system_settings_form($form); return system_settings_form($form);}

Add Annotation to Node /** * Implementation of hook_nodeapi(). * Implementation of hook_nodeapi(). */ */ function annotate_nodeapi(&$node, $op, $teaser, $page) { global $user; global $user; switch ($op) { switch ($op) { case 'view' case 'view' if ($user->uid == 0 || !$page) break; if ($user->uid == 0 || !$page) break; $types_to_annotate = variable_get('annotate_node_types'); $types_to_annotate = variable_get('annotate_node_types'); if (!in_array($node->type, $types_to_annotate, TRUE)) break; if (!in_array($node->type, $types_to_annotate, TRUE)) break; $result = db_query('SELECT note FROM {annotations} WHERE nid = %d $result = db_query('SELECT note FROM {annotations} WHERE nid = %d AND uid = %d', $node->nid, $user->uid); AND uid = %d', $node->nid, $user->uid); $node->annotation = db_result($result); $node->annotation = db_result($result); $node->content['annotation_form'] = array( $node->content['annotation_form'] = array( '#value' => drupal_get_form('annotate_entry_form', $node), '#value' => drupal_get_form('annotate_entry_form', $node), '#weight' => 10 '#weight' => 10 ); ); }}

How does Drupal Work? Web server tasks: Web server tasks: Request arrives at server, e.g. example.com/foo/bar Request arrives at server, e.g. example.com/foo/bar mod_rewrite rules (in.htaccess file) change URL to mod_rewrite rules (in.htaccess file) change URL tohttp://example.com/index.php?q=foo/bar Processing begins with index.php, with path (foo/bar) passed in as a GET parameter Processing begins with index.php, with path (foo/bar) passed in as a GET parameter

How does Drupal work? Drupal takes over… Drupal takes over… Drupal bootstrap process (defined in bootstrap.inc) Drupal bootstrap process (defined in bootstrap.inc) Initialization: set up internal config array. Process settings.php Initialization: set up internal config array. Process settings.php Open database connection Open database connection Sessions are initialized or read from database Sessions are initialized or read from database Page cache: Drupal loads enough code to determine whether to serve a page from the page cache Page cache: Drupal loads enough code to determine whether to serve a page from the page cache Path: code that handles path aliasing is run Path: code that handles path aliasing is run Full load Full load Process request Process request Theming Theming

Processing the Request Callback function does whatever is required to process request Callback function does whatever is required to process request For example, q=node/3: For example, q=node/3: "Callback mapping": URL is mapped to function node_page_view() "Callback mapping": URL is mapped to function node_page_view() (A function like node_page_view() is called a "hook") (A function like node_page_view() is called a "hook") Node module generates output variables Node module generates output variables Then, it's time for theming Then, it's time for theming

Summary Modules are defined with.info files Modules are defined with.info files Modules implement hooks to do stuff Modules implement hooks to do stuff Hooks are functions that are called for each module when system events happen, e.g. page load or user login Hooks are functions that are called for each module when system events happen, e.g. page load or user login