My BlogAbout MePortfolioTemplatesArticlesWeb StoreMessage Board (Forums)Guestbook

Recommended Stuff

Browse archives

September 2012  
Mo Tu We Th Fr Sa Su
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search this site with Google

Drupal for Solid Lifeforms

Submitted by Jakob on 4 September, 2006 - 20:32.My Blog | Drupal | Human-Computer Interaction | Web Design | XHTML

A beginners FAQ and guide to one of the most formidable content management systems on planet Earth

Some of you who frequent my site may have noticed that I work a lot with Drupal and now offer Drupal-related services such as customization and design. If youre curious about what Drupal is and what it can do for you, how you can build a better site - a site thats easier to maintain using a state of the art CMS, this guide is for you.

Whom is this guide written for?

This is written for everyone with an interest in CMSes and Drupal and who has a basic understanding of web publishing, design and development. The goal of this guide is to explain the basic concepts and features of Drupal and show examples of how they can be used on a real Drupal powered website in order to inspire. My goal is simply to bridge the gap between theory and practice and turn a rather fearsome leap over the abyss of the unknown into a walk across the bridge that is this guide, the bridge you are now taking your first steps on.

What is Drupal?

Drupal is framework and a so called content management system, or CMS for short. Content management systems allow you to easily structure, create, automate, build, present and maintain large collections of content. Most CMSs are designed to power websites and relieve webmasters of the burden of repetitive tasks, allowing them to focus on providing fresh interesting content and building a great website.

Why should I choose Drupal?

There are many open source CMS solutions available, some of the most popular are Joomla, phpNuke and Drupal. While choosing a CMS is much a matter of taste and what floats your boat, there are technical aspects. Of all the free open source content management systems available today very few offer such a flexible, open and developer-friendly architecture as Drupal and such complete documentation, factors that make Drupal the perfect choice if you need a solution that allows growth. When your site grows, Drupal will grow with it since you can modify so many aspects of it and add new features as necessary.

Is Drupal hard to learn?

As with everything theres a threshold, some say Drupals threshold is higher than that of other CMSs but I dont agree. This guide is an attempt to lower that threshold further by explaining some of the underlying concepts of Drupal. Since in order to use Drupal effectively you need to understand how its different components work together, how you can build your site using these components, and take advantage of some of the brilliant features that makes Drupal truly shine.

The underlying concepts of content management in Drupal

Drupal offers several tools and concepts to handle content effectively. I will list some of these defining features here and explain how they apply to running a regular website.

A website understood in terms of content management

When you think about a site, in fact imagine a website now. What comes to mind first? The layout perhaps? Well it depends on whether youre a visual thinker or not but most people are aware of layout, or rather what kind of content they want there, those ideas be sharp and well-defined or fuzzy. If you are an experienced web developer you will also consider how you can achieve it, you think in terms of CSS, XHTML and various other server and client-side technologies. I will address all of these aspects in this guide.

But for now I will assume a more holistic view of website building here as this guide is meant to be of use to people at all levels. So let us, for the sake of simplicity imagine our site, its front page and its general layout.

Because of the underlying metaphors of the web, websites are considered having pages. Each of these pages cover a certain topic, contains an article or some piece of information or content. Some pages list dynamic content, sport results listing or posts in a forum topic.

Similarly, a websites front page lists new pages, new articles, new forum posts or may even aggregate information from other sites. Now looking at Drupal without a clue how it works, it may be hard to imagine how this all can be done. I will attempt to answer that question.

Presenting the node (content)

In essence, and according to the Drupal view of things, a website is merely a collection of content objects, and the presentation of these is controlled by logic (programming) and design (XHTML and CSS). In Drupal, all content is stored in nodes and a node is a content object. Just like there are different kinds of content, say a news item for the sites front page and a regular sub page, there are different types of nodes.

Nodes are very versatile and can be accessed in many different ways. A node and its content can be displayed all alone, like a page on a site, or it can be listed along with all other nodes that are either of the same type or share other properties. Unlike in some CMSes, such as TYPO3, nodes do not exist in any form of hierarchy, such features are provided by the Taxonomy module which I will explain later. As you will see, the node abstraction allows us to manage content very effectively.

The easiest way to build your website is to create all content as nodes of the type Page. Like I mentioned earlier, there are different types of nodes, all intended to be used for different kinds of content. The Story node type is intended to be used for news, content that has a lifespan and is recent. The Page node type is intended for static information such as the pages on your site that hold the sites information. There are several other node types, and you can even create new nodes types or download modules that add additional nodes types to fit the needs of your site, however explaining this is beyond the scope of this guide.

Nodes can have several revisions, or versions. When you save your node you can check the option to have a new revision made, by doing so the old version will not be overwritten but stored allowing you to revert to it should you change your mind about the changes you just made.

By default, a Drupal sites front page will list all the nodes set as as promote to front page ordered chronologically, most recent coming first. By selectively only promoting Stories to the front page, you can easily create a flow of news items directly accessible to those coming to your site. However should you not want that you can always change the node type's default settings in administer -> settings -> content types.

All nodes are identified by their NID, which is short of Node ID. The NID is used to identify the node in the database where it is stored. You can also access all nodes on your site by typing in the following after your sites address: node/NID where NID is the NID of the node you want to access. Doing this will display the node in your browser.

Using NID as reference, by programming or by advanced site customization nodes can also be included in other nodes, or in blocks which are the second concept I am going to present.

Blocks for displaying information (presentation)

When you build a page layout you usually intend certain areas of the page to contain certain content. These areas can contain text, images, navigation or different kinds of sidebars. When it comes to the elements that make up the different parts of a web page layout, Drupal distinguishes between content and blocks. Content is the body of a node and could consist of text and/or images. is displayed in a designated area on a page. Blocks are containers for things such as navigations bars, links and log in forms, that are shared by many (or all) pages of a Drupal site.

A block is a box (with or without visible border) which you can move around by assigning it to the different regions. Blocks are more free compared to content since they can be moved around. Where you can place blocks depends on the regions available in the theme you are using. Regions are areas and containers that you place blocks inside. The block system also allows you to change what blocks to display where depending on what section of a site you are in. In a three column layout, the left and right columns along with header and footer are the areas with regions, with the center column used for content. The default Bluemarine theme (in Drupal 5 the default theme is called Garland) allows content to be placed in at least these four different regions.

Typical uses of blocks is to display navigation menus that are the same across all pages of a site, display who is logged in or a log in form for members. In essence; blocks are good for things that are shared across the pages of a Drupal site, with the added advantage that you can decide exactly om what pages a certain block should be visible.

You can also create your own blocks with your own content. In this way, a block can work as a regular node, except it lacks some features such as limiting access and supporting revisions or the ability to easily edit it by clicking its edit tab.

Most themes have one primary column for the content, that is the container for the content of the node being displayed, and side containers for blocks as this is a very common and popular website layout. This however doesnt mean this is the way a Drupal site has to be designed. My site which you are looking at right now uses a less conventional layout. For other examples, see the links below.

A lot of people wonder how to create front pages and web site pages with more complex layout than the one I just described. The layouts may consist of several containers of content and several navigation bars and links, banners et c, in essence all the glamour and splendor we have come to expect from modern websites. Blocks can help you achieve this by combining them with your own custom theme and additional modules such as Views and Panels, which allow you to present information in an unlimited number of ways. By building your layout and creating a region for each area you want to place content in, you can very effectively assign content to specific areas and build complex layouts. I mention this as a side note, since explaining how it's done is beyond the scope and purpose of this guide.

For some inspiring examples of Drupal powered sites with alternative layouts, please see:

http://www.theonion.com
http://www.terminus1525.ca
http://www.mtv.co.uk
http://www.flixya.com
http://www.webbredaktoren.se

Taxonomy for classifying and ordering content (structure)

One of the features that set Drupal apart from every other CMS available today is something called Taxonomy, sometimes referred to as categories. I prefer the former term as it better captures how powerful this concept is.

Taxonomy is a powerful way to categorize and structure the content of a site and to specify how different categories are semantically related to each other; that is how their meaning is related. Using Taxonomy you can build trees (known as vocabularies) of topics (known as terms) to define the conceptual and semantic structure of your site. The tree can illustrate the purpose, meaning and relationship of one node to another. This may sound like mumbo jumbo to most people new to Drupal but once you get the hang of it, youll be hooked.

In order to better illustrate the advantages of Taxonomy, Ill get real and make an example. Imagine you a run a site where people have blogs. Support for blogs is a core component of Drupal and lets every user at your site run his or her own blog. Every blog entry is stored as a node. In order to better structure your site you have also set up a vocabulary called topics, it is a flat vocabulary meaning it doesnt form a tree so it doesnt have any hierarchy, it's a list of terms. It is also set up to support free tagging, meaning your users can add their own terms to the tree ad hoc; that is add them as they need them. You have also specified that blogs must at least have one term in this taxonomy; forcing people to assign terms to their blog posts as they make them.

A user on your site, Anna, just created a great new recipe for cinnamon cookies and wants to share it with her friends so she makes a new blog post about her cookie recipe and how she came up with it. She uses the tags/terms cookie and recipe to describe her blog post and clicks Submit. Her blog post is now available for other people to read.

Sean, who loves cookies and sometimes bakes, and happens to have a day off work, decides he wants to bake cookies. Sean is a regular member on your site and knows that some of the other members are good at coming up with new recipes. Eager to try something new, Sean browses your site. Now this is a situation you have anticipated, therefore youve made it possible to search content by taxonomy terms; that is search nodes tagged with certain terms. Sean searches for the terms cookie recipe and several hits pop up, including the one Anna just added. By clicking either term, Sean can also find more blog posts about cookie or recipe. Still, we've only brushed the surface of what you can do using Taxonomy.

It turns out Sean loves Annas cookie recipe and returns to post a comment on her blog post thanking her for sharing her recipe on the site.

Comments (user interaction)

What Sean just did was to interact with another member at your site. He posted a comment on her blog post. Every node type, be it Pages, Stories or Blog Posts, supports comment posting. That means that you can decide if you want to allow registered users to guests (anonymous) users to actively contribute to your site and spawn new discussions on the topics covered.

Comments are associated with a node, they are not nodes as such however some people in the Drupal community have the view its the most logical approach. Regardless, comments are an essential part of any site that wants to encourage user contribution and interaction.

Modules (unlimited extension)

All of the features Ive listed above are made possible through Drupals module system. A module adds new features, or enhances existing ones. Drupal ships with a number of core modules; the blog module is one of those. There are also hundreds of user contributed modules that add features to your site and which can be download from the Drupal website. Installing a module is a snap, download, uncompress, upload and install. Installing and deactivating of modules is done using Drupals module administration area.

Unlike some forum and CMS system, modules do not require you to edit code manually, in fact no changes are done to the Drupal files, instead Drupal uses a different approach which allows you to enable and disable modules at any time. In fact, Drupal has a feature called Throttle that allows you to disable certain modules when your site is under heavy load and has many simultaneous visitors in order to keep it working.

Path (page names that make sense)

Another defining feature of Drupal is the path module, which is also included in core. The path module allows you to make your site's URLs make a lot more sense than they otherwise would. The URL is the address your visitors will see in their browsers address bar when visiting your site. It consists of a domain name (for example www.yoursite.com) and a so called path to the page or section of the site that is being viewed. A lot of websites today have pages with paths that make absolutely no sense, for example:

http://www.cnn.com/2006/HEALTH/conditions/08/24/hpv.talk.ap/index.html

Yet this is one of those that make relatively much sense since we by looking at it can deduce that the page in question concerns health. With the path module you can assign user-friendly, easy-to-remember paths to your pages. See this example with the default path for the Page node with your About Me page and its corresponding path thats easier to remember and makes more sense:

http://www.yoursite.com/node/18 -> http://www.yoursite.com/aboutme

Human-readable paths arent just easier to remember, they look more professional as they hint at the fact that your site does indeed use a CMS and doesnt rely on static .html-documents.

In the next part I will explain how you build a regular web site with Drupal, how you create your own menu, customize the header and footer and fill your site with content using nodes such as Pages and Stories.
 


I am posting this guide in parts as I write them, it will eventually be compiled as a complete guide and edited for consistency to be published here.



Trackback URL for this post:

http://www.jakob-persson.com/trackback/512
Submitted by Harry (not verified) on 5 October, 2006 - 01:52.

Thanks for this... very well-written, very easy to read, an excellent introduction to Drupal basics, which is something I haven't been able to find anywhere else on the net. I am taking my first baby-steps in Drupal and this definitely gave me a push. Look forward to any updates.

Submitted by Jakob on 5 October, 2006 - 15:27.

Glad to hear that! I've tried to fill a gap. This is the kind of tutorial I needed when I was still learning Drupal but I made it anyway thanks to some very friendly and patient people in the Drupal IRC support channel (#drupal on irc.freenode.net).

I hope to be able to write the next part soon, I've been busy with work so it's been delayed. If you have anything you'd like me to cover in particular, let me know.

Submitted by Anonymous (not verified) on 26 October, 2006 - 19:25.

Drupal is a web CMS, not a general CMS. People who think it is anything more than that, and compares at any level to a deep CMS, are uneducated.

As well, many other CM systems have had taxonomy features for quite some time. But it's common in the myopic Drupal world to have all these claims of "firsts" and sloppy comparisons (like the laughable document claiming Drupal design has so many sophisticated features - Drupal's design is successful because it is a giant hack upon hack, er, hook) - keeps the clients happy, and the giant developer egos soothed (they can't get work done any other way).

Which goes along well with creating a mythos around the scary tech that the techie (who is not even a solid form) is gonna make easy to use with their special magic.

Well, thanks for trying. Drupa is so successful because of tactics like this.

Submitted by Jakob on 28 October, 2006 - 12:57.

I actually let this comment pass approval because it's such a bad comment, just to make a point about bad comments.

Please, whoever you are, make something constructive yourself instead of trashing the efforts of others. Really, all I see above is a lot of complaining, ignorant such too. I'm not a techie by the way, just someone who likes to help people. Maybe you should try that too, it's considered "constructive". ;)

Submitted by Sita Bhatt (not verified) on 30 October, 2006 - 09:54.

This is amazing information for us budding Drupal'ers. Looking forward to the next part.
Rgds
Sita

Submitted by Aukcje (not verified) on 3 December, 2006 - 23:07.
Thanks for this article... Very good to read :)
Submitted by Dave S. (not verified) on 10 January, 2007 - 15:37.

Hi Jakob,

This is a very good intro to Drupal. There are of course one or two books published already (in particular "Building Online Communities with Drupal, PhpBB, and Wordpress" with the section on Drupal by Robert T Douglass) but it's great to have such a readable take on the subject.

On my site, I had to disable comments for anonymous visitors as the site was quickly subjected to a large amount of automated spam , much of which was highly objectionable. I then made it a requirement that contact details should be left. The spam continued in different form, now with fake email addresses. I have had to request that an account be created in order to leave comments.

I would like to use a verification system like the one you use; is this a Drupal module? If so, can you tell me the name?

best regards

Dave S.

Submitted by Jakob on 18 January, 2007 - 18:08.

Thanks for the tips on book titles, however the one you mentioned is actually available for purchase in my web store here on the site. :)

I am using the Captcha module together with comment moderation. I still get some spam though, spam posted by humans since the Drupal captcha is yet to be cracked. I've also written an article about different methods to prevent spam:
http://www.jakob-persson.com/node/470

Submitted by Meble (not verified) on 31 January, 2007 - 14:39.

Emil: Can i too add this on mysite? Your side has very helpful articles.
Thanks and best regards

Submitted by Jakob on 1 February, 2007 - 05:20.

Hi,

Glad to hear you like them. Please don't republish this article, it's far from complete, just post a link to it here. The article will probably be contributed to the Drupal handbook at some point but right now it needs much revising.

Submitted by lsm (not verified) on 25 February, 2007 - 22:55.
Very good read. thanks! Drupal rules
Submitted by Roth (not verified) on 16 March, 2007 - 10:29.
I really needed this. I am currently developing my site (actually I am more preparing for developing) and I am gathering information about different CMSs so I can finally decide which one to use and which is best for me. Your read really comes in hand in the right time for me.
Submitted by mcclainmartin on 29 March, 2007 - 19:03.
Can anybody explain me what distinctions between xml and xtml? for example article about study xml here. Tell me wheare i can find information about xhtml?
Submitted by Jakob on 19 April, 2007 - 09:50.
Try this site: www.w3schools.com They have extensive tutorials on XML and XHTML. In essence, XHTML is HTML adapted to the XML specification and with the semantic properties and functional separation that comes with that.
Submitted by Mike (not verified) on 1 April, 2007 - 19:20.
fantastic guideline for everyone which interested in drupal. btw. u really like it or? ;-) i would suggest it for others. very good resources too. thanks Jakob.
Submitted by Horoskop (not verified) on 2 April, 2007 - 12:17.
Very good read. thanks! Drupal rules! I really enjoyed :-)
Submitted by Reinigungstechnik f?fis (not verified) on 2 April, 2007 - 17:37.
Great and excellent article t?s realy helpful. Thanks again. I will visit it again.

Post new comment



The content of this field is kept private and will not be shown publicly.


*

  • Web and e-mail addresses are automatically converted into links.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.