This section will guide you through some of Drupal's features, just to get your feet wet. All of these items will be revisited and discussed in detail in the following chapters.
Drupal takes great care to keep the elements of content and its presentation of a site separate. This allows you to come up with multiple designs for the same content. These designs are called themes. Each theme can consist of one or more files that work together to present the content of your site in a unique way. Drupal has four themes available as part of the core download, and many more available in the contributions repository on Drupal.org.
To see themes in action, navigate to administer > themes. This page presents a list of all the installed themes. You can enable them individually by checking the Enabled check box, and you can choose one to be the default theme. Drupal allows registered users to choose which theme to use from among the enabled themes. That user will then experience the site in the theme of their choice. If you want your site to be viewed in only one theme at all times, leave only one theme enabled.
Try enabling the Pushbutton theme and setting it as the default, and then click Save Configuration. Your front page should now look something like Figure 1-6.
edit primary links | edit secondary links |
Figure 1-6. The Pushbutton theme
A block is a unit of content that you can place in the various regions of the layout. Blocks can do many different things. The login fields and the main navigation menu are each blocks, for example.
To see the list of available blocks, navigate to administer> blocks. The table on the blocks page lists all of the available blocks by region, or under Disabled for those blocks that are not yet turned on. You can enable any of the disabled blocks by checking the Enabled check box and clicking Save Blocks. You can also change the region of the screen where they appear. You have the choice of right or left sidebar, header, footer, or content. Feel free to try moving blocks around and turning them on or off.
Tip If you disable the user login block and get logged out, you will need to use the following URL to get to the login screen: http://www.yoursite.com/?q=user. If you disable the navigation block and are left wondering how you'll ever get back to the block administration page to turn it back on, don't despair— here's the URL: http://www.yoursite.com/?q=admin/block.
Blocks are generally provided by modules, which means that as you enable or install more modules, more blocks will be available. Make sure to visit the block administration page whenever you enable a new module to see what it has to offer.
A fresh installation of Drupal has only a small fraction of the available functionality enabled. The most common way to enhance Drupal and add functionality is through modules. Drupal comes with more than 30 modules installed, but most of them are disabled by default.
To see a list of available modules, navigate to administer> modules. All of the modules listed on this page correspond to individual files in the /modules directory in your Drupal installation. You can enable them simply by checking the Enable check box and clicking Save Configuration. I describe each of these core modules in detail in Chapter 3. I highly recommend trying them all out, one by one! To get you started, Exercise 1-1 demonstrates how to use the Menu module.
A common question for people unaccustomed to working with Drupal is, "How do I make a custom navigation menu that links to pages I choose?" This exercise shows you how to do just that.
1. Select administer> modules. On the module administration page, enable the Menu module.
2. Select administer> menus and click the Add Menu tab.
3. On the Add Menu page, give your menu a name (for example, Custom Menu), and then click Submit.
4. Select admlnlster> blocks. On the block administration page, enable the block for the menu you just added (for example, the Custom Menu block), and pick the region where it is to appear. Click Save Blocks.
5. Click create content. Choose a content type to create as a test; page is a good choice. Choose a title for the new content and write some text in the Body field.
6. At the bottom of the content-creation form, click the Menu Item Settings link to expand the options. These settings will create a link in your custom menu to the page currently being created.
7. The Title field in the Menu Item Settings options will be the text of the hyperlink in your custom menu. Enter some text, such as Test page.
8. The Parent Item drop-down selection box is used to place the link to the page you are creating in the menu. All of the items at the top of the list belong to the navigation menu. Scroll past all of those to the very bottom until you find the Custom Menu option. Choose this, as the goal is to place the link to the current page in your newly created custom menu. Figure 1-7 shows what the form will look like at this point.
TMenu item settings — Title:_
The name to display for this link.
| Custom Menu
Preview | Submit |
9. Submit the form to create your new page, The result will be a link called Test page in the new custom menu. Clicking the Test page link will take you to the page you just created.
10. Create more content, or edit existing content, repeating steps 6 through 9 to fill out your custom menu.
For Drupal, every posting that you make has a content type. You choose the content type from the list of available types from the create content page. The content types that come with the core Drupal download include pages, stories, books, polls, forum posts, and blogs.
While each of the content types is different from the others in some way, they all share certain characteristics. They all have a title, an author, and a creation date, and they can track revisions. They also share certain features: they can have comments, categories, file uploads as attachments, and more. In fact, all of the content types in Drupal can have these and other services. For Drupal to offer these services to all content types, even when the content types are inherently different from each other, it needs some general way of dealing with content— some abstract idea of content that allows Drupal to deal with forums and blogs in the same manner when it comes to comments or categories. To this end, all of the main content types in Drupal are called nodes.
When Drupal builds pages for display, it first deals with the content at the general, or node, level. This is convenient for providing services like comments and categories. Then Drupal deals with the content at the specific content-type level, which is what makes a forum different from a blog, and so forth.
For anyone who has dealt with XML or other hierarchical data structures, the use of the term node will make sense, though hierarchy isn't inherently implied here. For those of you who have a background in object-oriented programming, you can think of node as the generic superclass, and all of the specific content types as subclasses that inherit from it. Otherwise, it is safe to think of node as a synonym for content, or posting.
The strategy of handling all content first as a generalized node, and then as a specific content type is extremely powerful and helps programmers extend Drupal with surprisingly little effort. The abstract handling of nodes is one of the features that make Drupal a stellar platform for building all sorts of web applications.
One of the services that Drupal extends to all content (node) types is the option of enabling comments. Comments give visitors to your site the chance to participate in the dialogue started by the original post in the form of comments that are typically displayed below the post itself. This is how Drupal forums are built.
In the default Drupal installation, comments are enabled for every content type, so no further configuration is needed to use this feature.
Drupal has an excellent tool for helping you name and organize the content you create on your web site: the Taxonomy module. In fact, it is one of Drupal's killer features because of the numerous ways in which it is used and the value it adds to your site.
Note The definition of taxonomy, according to the Cambridge dictionary (http://dictionary.*-cambridge.org/define.asp?key=81540&dict=CALD) is "a system for naming and organizing things, especially plants and animals, into groups which share similar qualities." Drupal taxonomies use vocabularies, which are the "groups which share similar qualities." The words that actually describe things are called terms, and are added to vocabularies. In other words, all of the terms that you would use to describe one aspect of something go into the same vocabulary. For example, black, green, gray, and orange would go into a Color vocabulary.
The easiest way to understand what the Taxonomy module can do for you is to consider the tags that are used on sites like Flickr and del.icio.us. Tags let people describe content— such as bookmarks, blogs, and pictures—with keywords. Drupal can do this, too, using the Taxonomy module. Exercise 1-2 demonstrates how to use the Taxonomy module to set up free tagging. Chapter 3 discusses this module in detail.
Exercise 1-2. Set Up Free Tagging for Pages
This exercise will show you how to add free tagging to the Page content type.
1. Select administer> modules. Enable the Page module, if necessary, and the Taxonomy module.
2. Select administer> categories. This is the control panel for the Taxonomy module (categories is more readily understandable to most people than taxonomy).
3. From the category administration page, click the Add Vocabulary tab.
4. Give this vocabulary the name Tags. Skip the Description and Help text for now. The Types field lists all of the various content types that you have enabled. Check the box next to Page. Find the Free Tagging check box and check it. Then click Submit.
5. Create a new page by clicking create content and choosing Page.
6. On the content-creation form, underneath the Title field, is a new field called Tags. Here is where you enter your tags. Tags are separated by commas, allowing you to make multiple-word tags. For example, "City, New York, Travel" would create three tags for the page: City, New York, and Travel. Enter some tags for the page, finish creating the body text for the page, and click Submit.
7. The newly created page will show each of the tags you entered as a link. These links lead to a list of all content on your site that has been tagged with that particular tag. Figure 1-8 shows an example of a page with free tagging categories.
Submitted by admin on Mon, 10/03/2005 - 19:59 City | New York | Travel
Figure 1-8. A page with free-tagging categories
Was this article helpful?