Drupal, CCK and Views in a Nutshell

This is a brief introduction to some terminology to help understand the process of building websites with Drupal.

All content is stored in a 'node'. Nodes have a node ID called the 'nid' and a 'content type' which is basically a way of defining its 'fields'. We can create arbitrary content types using CCK to create the structure. CCK has a form building engine that builds a 'form' to allow us to create nodes of that content type. Access to a node is determined by 'permissions' granted to a 'role'. If a user with a certain role can edit the node, he can edit any field in the node that appears on the form. If you wish to restrict access to certain fields, you should separate those fields into a different node or write a custom function in 'template.php' which will be processed before rendering the page. As well as the global settings, each content type has its own 'settings' which affect the way the site behaves.

The Views module allows us to query the database and build data objects through 'relationships'. We can also pass an 'argument' to a 'view' so it can be used to affect the results. Eg. we pass the argument 'nid=32' from a Business node to a view of all Event nodes to get a set of only those Events for that Business. The view can return data as a 'page' where it is the main content, a 'block' to supplement the main content or something else depending on the modules installed (eg. a calendar). In this case we would return a block of Events to be displayed when the Business is displayed. The results can all be styled and displayed differently by overriding the default displays in the 'theme'.

Each theme has its own 'templates' for building HTML tags around the content's fields, and CSS 'stylesheets' to style the HTML. Therefore if we change themes, the new theme must also have the same templates and stylesheets as the old theme or they will revert to the defaults and break the formatting of the site. That's why it's important to select a theme early on in the project. Some themes insert CSS classes which can be used to style a particular page or section of the web site according to the URL path to the page.