Theme development

November 6, 2008

The information is copied from Anatomy of a Drupal theme.

.info (required)
All that is required for Drupal to see your theme is a “.info” file. Meta data, style sheets, JavaScripts, block regions and more can be defined here. Everything else is optional.

template files (.tpl.php)
These templates are used for the xHTML markup and PHP variables. In some situations they may output other types of data –xml rss for example. Each .tpl.php file handles the output of a specific themable chunk of data, and in some situations it can handle multiple .tpl.php files through suggestions.

template.php
For all the conditional logic and data processing of the output, there is the template.php file. It is not required, but to keep the .tpl.php files tidy it can be used to hold preprocessors for generating variables before they are merged with the markup inside .tpl.php files. Custom functions, overriding theme functions or any other customization of the raw output should also be done here.

Sub-themes
On the surface, sub-themes behave just like any other theme. The only differences is that they inherit the resources from their parent themes. To create one, a “base theme” entry inside the .info file is needed. From there it will inherit the resources from its parent theme.


Drupal Terminology

November 6, 2008

Block
Blocks are the navigational or content additions that generally live on the left or right side of a page when you view it in your browser. Block placement can be placed elsewhere via the admin settings. Blocks are not nodes, they are just a way of positioning data within a page. The look of blocks can be controlled by each theme by defining the (code: block($subject, $content, $region = “main”) method.

Hooks
Drupal’s module system is based on the concept of “hooks”. A hook is a PHP function that is named foo_bar(), where “foo” is the name of the module (whose filename is thus foo.module) and “bar” is the name of the hook. Each hook has a defined set of parameters and a specified result type.

Module
A module is software (code) that extends Drupal features and/or functionality. Core modules are those included with the main download of Drupal. Contributed (or “contrib”) modules are available for separate download from the modules section of downloads. Note: Be sure that the version of the contributed module you wish to use matches your version of Drupal releases section lists modules by Drupal version

Block modules create abbreviated content that is typically (but not always, and not required to be) displayed along the left or right side of a page. Node modules generate full page content (such as blog, forum, or book pages).

Node
Almost all content in Drupal is stored as a node. When people refer to “a node” all they mean is a piece of content stored within Drupal. A node could be a poll, a story, an image, a book page, etc

Regions
Regions are essentially containers to which you can add blocks. You can also add other non-block content to a region using PHP. An example of a region is your sidebar.

Taxonomy
Taxonomy is literally “the science of classification”. The Drupal taxonomy system allows enables users to categorize content using both tags and administrator defined terms. It is a flexible tool for classifying content with many advanced features. Further information can be within the taxonomy system documentation.

Theme
A theme is a file or collection of files (php, theme, css, jpg, gif, png), which together determine the look and feel of a site. These files are often used by one of the theme engines available for Drupal which is a PHP file of functions which turn arguments into HTML markup. Drupal modules define themeable functions which can be overridden by the theme file.

Source: Drupal


Follow

Get every new post delivered to your Inbox.