Drupal 6 Technical Overview - Model

This prezi visually shows how Drupal's conceptual framework is structured. »
Jonathan Yankovich

Drupal 6 Technical Overview

Whats Missing?
Blocks
Regions
Rules
Triggers
Tokens
Actions

Drupal is a large framework, there are some concepts that are not expressed in this diagram.
How does a hook work?
Responding To
A Hook
Writing Hooks
Hooks allow you to execute code at various points in the drupal program execution.
Modules can 'write hooks' that you can hook into (respond to).  The abililty for module
authors to both write and respond to hooks allows modules to build off of each other
and hilights drupals extensibility and community levearge.
What's a hook?
The basic struture of a hook is a for loop that
checks for the existence of a series of function
names based on a list of module names and the
desired hook name, and calls any functions that match.

A developer can implement a hook loop at any point
in their code.
http://api.drupal.org/api/function/module_implements/6
http://api.drupal.org/api/function/module_hook/6

Drupal is full of hooks, which are special function
names that you can write into your module.  Drupal
will look for the function name of each hook, and if
it finds one, execute it.  This allows you to "hook into"
any point in the script execution to modify objects and
change what happens.
Any module can respond to a hook that has been written 
by another module.
http://api.drupal.org/api/function/hook_form_alter

Model
View
The controller is index.php,
the entry point into the framework.
Where's the controller?
Model Concepts
View Concepts
module
hook
weight
system table
form array
#attributes
#weight
#title
#id
system table wieght column
template
devel_themer
$vars[]
preprocess_node
theme()
block.tpl.php
comment.tpl.php
node.tpl.php
node-nid.tpl.php
node-nodetype.tpl.php
page.tpl.php
page-front.tpl.php
<?php print $title; ?>
.info files
defining your theme to drupal
<head>
source code
  <head>
    <?php print $head ?>
    <title><?php print $head_title ?></title>
    <?php print $styles ?>
    <?php print $scripts ?>
    <!--[if lt IE 7]>
      <?php print phptemplate_get_ie_styles(); ?>
    <![endif]-->
  </head>

and more!
  <?php// $Id: node.tpl.php,v 1.5 2007/10/11 09:51:29 goba Exp $ ?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php print $picture ?>
<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
  <?php if ($submitted): ?>
    <span class="submitted"><?php print $submitted; ?></span>
  <?php endif; ?>
  <div class="content clear-block">
    <?php print $content ?>
  </div>
  <div class="clear-block">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>
    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>
</div>

source: garland theme
page.tpl.php
node.tpl.php
hint:
Use Theme Developer
to see a list of templates
view.tpl.php
view-row.tpl.php
Drupal's flexible template system lets you
override sections of the page and control
where content is displayed using variables.
variables?
function theme_preprocess_page(&$vars, $hook) {
  $vars['variable_name'] = "Your Variable Value";
}
<div class="myclass">
  <?php print $variable_name; ?>
</div>
// Call them in
your template:
// Set variables in your
theme's preprocess function
name = Garland
description = Theme Description
version = 1
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
stylesheets[print][] = print.css
scripts[all][] = javascript.js

garland.info
Name
CSS
JS
What did I miss?

jonathan.yankovich@gmail.com
twitter: tronathan
thank you
core:file upload
allowed extensions
node import

Loading comments...

Please log in to add your comment.

Report abuse

More presentations by Jonathan Yankovich

More prezis by author