In this post I’ll explain some of the drupal terminology that I feel is the main reason for a slightly steep learning curve. Let’s start with the most important term in my mind: NODE
A “Node” in drupal is a piece of content on the site. Drupal saves its information in different “boxes”, but the most robust and the main box is a “Node”.
A node has a title, it has an author, a date it was created and a bunch of other fields that hold information and settings about a node. A node can be a picture, a blog post, a simple page, a product or anything at all.
Drupal 6 ships with two node types otherwise called “Content Types” – A “Page” which is mostly used for static pages, like About us, or Terms of service and a “Story” content type which has different settings out of the box such as comments, and file uploads.
A website can have many many nodes, some nodes are of the Page content type, and some can be of the Story content type. You can also create more content types using the CCK module.
CCK (CCK or Content Construction Kit is now part of core Drupal 7 no additional module required) allows you to create more content types and for each content type you can have different settings and different fields. One content type can be to store portfolio items and have fields such as title, description, url, and picture, while another content type can be a product that has a price field, weight.
You think you know what a page is….but “Page” is used in drupal in different locations.
There’s the example from node – the Page content type, where page is simply a descriptive name for the content type and could have been called anything at all.
Another use of the “Page” in drupal is a type of display for content, or rather the outermost frame of a webpage. The page is everything you see, it includes all the sections of website you look at in the browser window, it has a URL (a path) and can contain nodes or other information in drupal, for now this section will remain kind of mystery but you’ll understand more once you see what other types there are…which brings me to Blocks
If a page is everything then a block is a self-contained element in the page. You can have many blocks in a page, and blocks can contain my types of information. You have a block that has a login form in it, a block that just has the little footer copyright text. A block can contain the website menu, or the search form. A block can even be a node, or rather a node can be displayed as a block.
Well, by this point I’m pretty sure I’ve confused you more than made sense about the drupal terms, but drupal is about the big picture, and once you understand the different terms you understand the whole picture….so let’s move on…
A view is created using the Views module, a view is used to select specific information from your website, and display it in any way you want.
Let’s start with a use case and go from there….I want to select all the nodes of the portfolio item content type in my site, and display them as list. I’d create a View, add a filter to only select the content type: Portfolio. Now I can choose to create a “Page Display” for this view. This means that the view will be a page and have a URL let’s say www.mysite.com/portfolio. All the Portfolio items will be displayed in the page www.mysite.com/portfolio this page is generated by a view which is displaying nodes of the portfolio item content type.
I can also create a list of the three latest portfolio items, so I setup a view, filter it by portfolio content type, sort it by date, and set it to only display 3 items. This time I want to display the view on the front page, so I choose to display it as a “Block”. I can incorporate this block in the front page, or any other page for that matter.
Fields are what make up the node, you have the default fields such as “Title” and “Body” (can be removed), and you have additional fields you can add in order to customize the content type. Fields come in a variety of types, some are part of the CCK module and some are additional modules that add more options. Some examples of field types are: Phone, Email, Text Area, Text field, Money, Date, Integer, Computed, Image, File upload, Embed Media (youtube videos) and many more.
Drupal uses a bunch of templates to control the output of all its elements and content. There are base templates that control how all nodes look, or how all blocks look. But you can also override a general node template, and create a template that controls how nodes of a specific content type look like.
The templates are php files, that output the different variables and content stored in drupal in html containers. So Portfolio nodes should have the Title wrapped in an <h2> tag, while blog posts should have the date appear first, and then the title in <h3> tags.
Using templates you customize the output and you can create a general block.tpl.php file to control all blocks, or block-menu.tpl.php to control the output only of menu blocks. Same goes for nodes, from the most general node.tpl.php to a more specific node-portfolio.tpl.php to the very specific node-143.tpl.php
Other than nodes and blocks, you have template files that control the output of views and pages.
Using the Page templates, you can create “Regions” which I will explain next…
Regions are areas in a page HTML where you can place blocks. A page template can have as many regions as you want, and you can place them where ever you want. In the code you output a variable, for example <?php print $leftcolumn; ?>
and in the theme info file (theme_name.info), you define the region so drupal will know to look for it; regions[leftcolumn] = Left Column
The theme is a collection of all the template files, images and css files used in your website. Excluding of course the default, core or module specific files. In the theme you can override the base files in order to customize your site.
A theme usually contains the info file – themename.info and a template.php file which contains all the override theme() functions – I won’t get into this now, but this is a way to override how different modules and aspects of drupal render the content.
Menus are pretty much what they sound like, they control the links to navigate around the site.
You can have many menus, and each menu has different menu items, which are the individual links to the pages. Menus are as expected hierarchal, so you can have many levels in each menu (parent links, and child links).
Each menu creates a “Block” with the menu output for display. There are many modules that enhance the menu system, I especially like Menu Block, which allows you to split different menu levels into different blocks (top Level at the top, 2nd level on the left..etc).
Taxonomy – Vocabularies and Terms
The taxonomy module controls the categories of your website, with the taxonomy module you can define Vocabularies which are a collection of terms in a group.
I can create a vocabulary to define the category of the Portfolio item, this vocabulary will contain the terms, Logo design, Print, website design etc.
I can then create another vocabulary that will hold the names of the people that worked on each project, and it will have the names as terms (if I wanted to give each user a bio, I could create a staff member content type and link each portfolio node to the staff member node using a field called node reference).
When creating a Portfolio node, I would then select the appropriate category and staff members for this specific node out of the options in each vocabulary.
Vocabularies can have complex hierarchies with terms having child terms, and multiple parent terms.
Let me give a few real life example of what’s what from a website I completed recently http://www.invoke.com
Next up, Building a Portfolio website from start to finish with Drupal 7.