Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
This is an FAQ based on content management in Drupal. In here we try to answer some basic questions about content in Drupal. We have addressed topics like content types in Drupal, book module, CCK module, among others.
What is content in the context of Drupal?
We can certainly say that 'content' is any material that makes up the web page, be it Drupal-generated content, such as the banner and buttons, or user content, such as the text of a blog. Within Drupal, 'content' has more narrow parameters.
When you create a story in Drupal, it is stored in a database as a node, and is assigned a node ID (nid). Some would say that, with respect to Drupal, content is limited to objects (stories, and so on) that can receive comments created by users, and are assigned a node id. Others say that it is any object in Drupal that can be on a page. These technical discussions can cause your eyes to glaze over. It would seem that the latter definition makes the most sense; however, there is one additional factor that we need to consider, and that is the layout of the Drupal admin functions.
Drupal provides admin functions for creating and maintaining content, and these functions list only those objects that receive a node id. Other objects, such as Blocks, are created and maintained elsewhere.
What are the types of content in Drupal?
The following table lists the content types that ship with Drupal by default:
A blog, or weblog, is an author-specific content type that is used as a journal or diary, among other things, by individuals. In Drupal, each blog writer can, depending on the site's settings and their permissions, add attachments, HTML, or PHP code to their blog.
A good example of a blog can be found at: http://googleblog.blogspot.com/, which demonstrates an interesting use of the blog content format.
A book is an organized set of book page types (actually any type can be used nowadays), which are intended to be used for collaborative authoring. Book pages may be added by different people in order to make up one single book that can then be structured into chapters and pages, or in whatever structure is most appropriate, provided it is in a hierarchical structure.
Because pretty much any data type can be added to a book, there is plenty of scope for exciting content (think of narrated or visual content complementing dynamic book pages, created with PHP and Flash animations, to create a truly unique Internet-based book-the possibilities are endless!).
A good example of a book is the documentation provided for developers on the Drupal site, found at: http://drupal.org/node/316. This has been built up over time by a number of different authors.
You will notice that if you have the Book module enabled, an additional outline tag is presented above all/most of the site's posts. Clicking on this tab allows you to add that post to a book-in this way, books can be built up from content posted to the site.
Forum topics are the building blocks of forums. Forums can only consist of forum topics and their comments, unlike books, which can consist of pretty much any content type. Information in forums is categorized in a hierarchical structure, and they are extremely useful for hosting discussions as well as community-based support and learning.
Forums are abundant on the Internet and you can also visit the Drupal forums to get a feel for how they operate.
Just look on any website to see examples of such pages.
What about comments?
Comments are not the same as the other node types discussed in the previous table.
While there may be exceptions, the terms 'node' and 'content' are synonymous with respect to Drupal.
While, technically, they are content, consider the fact that one cannot create a comment without first having another node to add the comment to. Instead, you can tack comments onto other content types, and these are very popular as a means to stimulate discussion among users.
You can see comments in action by logging into the Drupal forums, http://drupal.org/forum, and posting or viewing comments on the various topics there.
How to work with content types?
It is possible to specify some default behavior for each of the content types. To do this, go to Content types under Content management to bring up the following page:
Each content type has a set of editable configuration parameters, so to get a good idea of how they work, click on the edit in the Book page row. The edit page is broken up into four sections dealing with the following:
- Identification – Allows you to specify the human readable name and the name used internally by Drupal for the associated content type, as well as to add a description to be displayed on the content creation page.
- Submission form settings – Allows you to set the field names for the title and body (leaving the body blank removes the field entirely) as well as specify the minimum number of words required to make the posting valid. Again, it is possible to add in submission guidelines or notes to aid those users posting this content type.
- Workflow settings – Allows you to set default publishing options, multilingual support, and specify whether or not to allow file attachments.
- Comment settings – Allows you to specify default comment settings such as read or read/write, whether or not comments are allowed, whether they are to appear expanded or collapsed, in which order and how many, amongst other things.
eBook Price: €20.99
Book Price: €34.99
How to create content in Drupal?
It takes just 3 steps. Drupal makes it very easy to post new stuff:
- Click on Create content
- Select the type of content you need
- Enter the content into the fields provided and set the desired properties and options.
What is Book module and how to add it?
A book, in the Drupal context, is a navigable structured document that can be authored collaboratively – provided that more than one person has permission to create book pages. It can consist of pretty much any type of content, including the default Book page and imbues its content with a number of features that make them part of the book. For example, navigation links are added to each book page allowing readers to traverse the book structure with ease.
How to create a book?
Creating a book is fairly easy.
After ensuring that the Book module is enabled, click on Create content and select Book page:
Adding a title for the book and a brief summary of what it is about is really no different from creating any other type of content. The difference comes in setting up where in the book's structure this page is going to be placed. Scroll down the page and open up the section entitled Book outline:
Selecting <create a new book> from the drop-down list indicates that we wish this page to be the start of a new book—Drupal dutifully informs us that this will therefore be the top level page in the book. With that done, go ahead and save the changes—if you intend on working on the book regularly, perhaps consider adding it to the navigation menu for easy access in the Menu settings section first.
When viewing this page it now becomes clear how the rest of the book can be built by adding pages:
Click on Add child page and call the new page Chapter 1. The important part of adding any content to a book comes in the Book outline section where we can specify where in the book this page must be added:
In this instance, we want this page to be part of the new book, and more importantly, its parent item must be the original book page. Click on Save and then create a few more chapter pages so that you end up with something like this when viewing the book:
It is easy enough to then begin adding content to each chapter by adding sections or articles, and Drupal actually mentions on the content creation page that it will accept up to 9 levels of depth in the content. Of course, adding content to each chapter requires us to specify the chapter in the Book outline section:
With this new child page added to Chapter 1, the book outline now tells us that there is something contained within the chapter by modifying the bullet:
Clicking this link now brings up the child page(s) along with the book's associated navigation:
That's all there is to it!
What is Drupal Content Construction Kit (CCK)?
Drupal provides the CCK module as a way to build custom content types that can be tailored to suit your needs. In effect, it gives you control over which fields are presented to a user whenever they post content using custom content types.
The term field refers to a given piece of content within a node. Conversely, a node is a collection of fields.
There are also a number of other modules that make use of CCK in a variety of ways. Most important among these is Views. Views provide administrators with the means to modify how Drupal displays lists of content, and CCK exposes its fields to the Views module, making them perfect partners when it comes to creating custom content and then displaying that content in a highly configurable manner.
eBook Price: €20.99
Book Price: €34.99
Resources for Article :
David Mercer was born in August 1976 in Harare, Zimbabwe. Having always had a strong interest in science, David came into regular contact with computers at university where he graduated cum laude with majors in applied math and math (although he minored in computer science).
As a programmer and professional writer who has been writing both code and books for about nine years, he has worked on a number of well known titles, in various capacities, on a wide variety of topics. His books have sold tens of thousands of copies and have been translated into over 6 different languages to date.
David finds that the challenges arising from the dichotomous relationship between the science (and art) of software programming and the art (and science) of writing is what keeps his interest in producing books piqued. He will no doubt continue to write professionally in the future.
David balances his time between programming, reviewing, writing, and contributing to interesting web-based projects such as RankTracer and LinkDoozer. When he isn't working (which isn't that often) he enjoys playing guitar (generally on stage and unrehearsed) and getting involved in outdoor activities ranging from touch rugby and golf to water skiing and snowboarding. Visit RankTracer or find him on LinkDoozer where he is generally lurking.
J. Ayen Green
J. Ayen Green is a software and web site developer, writer, and poet. He and his wife, Sofía-Aileen, make their home in New York City.
Books From Packt