You are on page 1of 82

Drupal 7 in a Day

Published 2011 by Acquia, Inc. 25 Corporate Drive, 4th Floor Burlington, MA 01803

Editor: Heather James This manual is partially based on material developed by Zivtech http://zivtech.com/ Acknowledgements Screenshots of the case study websites are used with generous permission of their respective trademark owners. We kindly thank Varnish Software http://www.varnish-software.com/ for use of screenshots of their site. We kindly thank openSource.com, a Red Hat community service, for use of screenshots of their site. Red Hat and the Shadowman logo are trademarks of Red Hat, Inc., registered in the United States and other countries. The copyright of all information contained in the screenshots of http://styleguide.yahoo.com/ is owned by Yahoo, Inc. We kindly thank Yahoo, Inc for permission to use their site styleguide.yahoo.com as a case study. The copyright of all information contained in the screenshots of www.london.gov.uk is owned by the Greater London Authority. We kindly thank the Greater London Authority for permission to use their site london.gov.uk as a case study.

Feedback
Your feedback is much appreciated. Please dont forget to tell us about your experience. http:// www.acquia.com/training-feedback

Appendix
Please download the PDF full appendices available at http://tinyurl.com/trainingappendix

Drupal 7 in a Day

Table of contents Course overview and welcome to Drupal!" Before we get started" Session 1: What is Drupal?"
Unit 1.1 - Drupal's strengths" Unit 1.2 - Whats in the box? Take an administration tour" Unit 1.3 - Common modules and conguration" Unit 1.4 - Installing modules" Session discussion"

3 7 8
8 8 17 21 25

Session 2: Content management"


Unit 2.1 - Creating and managing content" Unit 2.2 - Designing Content types" Unit 2.3 - Categorize content with Taxonomy" Unit 2.4 - Manage users" Session discussion"

27
27 32 37 40 48

Session 3: Site Building with Drupal"


Unit 3.1 - Create lists of content with Views" Unit 3.2 - Information architecture" Unit 3.3 - Layout" Unit 3.4 - Navigation" Session discussion"

49
49 57 61 64 67

Session 4: Extending Drupal"


Unit 4.1 - Modules Can Drupal do X?" Unit 4.2 - Themes" Unit 4.3 - Distributions and Install proles" Session discussion"

68
68 73 78 79

Session 5: Practical review. Apply what you learned."

80

Drupal 7 in a Day

Course overview and welcome to Drupal!


Whether you are a new to web development or a seasoned web applications developer, you can reap the benets of thousands of hours of development time that has been invested in Drupal- for free. As a new participant in an open source project, you develop on the shoulders of not giants but talented and busy developers like you. They are innovating, creating and giving great tools back to the community. By the end of this course you will see how you can:

Navigate the administration area to manage essential tasks. Congure and set up a basic Drupal site. Select, install and congure modules from Drupal.org Create content and congure content types. Manage user roles and accounts. Create listings of content Manage aliases and URL paths. Create blocks and place them in the layout Selecting, installing and conguring contributed themes from Drupal.org. Check your site thoroughly before going live.

All through Site Building that is, selecting and conguring a variety of modules.

About this manual


The click paths, indicated by > refer to paths using the Admin bar of the default admin theme of Drupal 7. This course assumes you are using Acquia Drupal 7 http://acquia.com/downloads This may either be locally, on your own computer, or remotely through a hosted service. Acquia Drupal 7 comes with these additional modules:

acquia_connector apachesolr mollom pathauto token

What to expect

Presentations, demonstration or discussion at the start of each session and unit. Exercises where you practice what youre learning. Challenges stretch your skills. If you have additional time, try the exercises and activities marked Challenge. You can also try to apply some of the activities to ideas relevant to your own work. This will help you come up with good questions to answer throughout the course. Tips advice about ways to speed things up, where to go next, recommendations for modules to check out. Summary and review - each unit and session has some thoughts for review.
3

Drupal 7 in a Day

Contributed modules you'll see in this course


With power comes responsibility. Each module you install needs to be maintained, as well each module you enable requires memory to run it. Therefore, there are maintenance and performance considerations to each module you install. With your test site you should feel comfortable to try as many as you like. Just make sure you disable, uninstall and remove them on a production site. We'll see more about this later.

Contributed modules used in this course


Depending on your situation, you might be using an online learning environment with these modules pre-installed. Or you may be installing them yourself on your site. This is the list of modules used in this course.

Administration menu http://drupal.org/project/admin_menu Advanced Help http://drupal.org/project/advanced_help Busy http://drupal.org/project/busy Calendar http://drupal.org/project/calendar Chaos tools http://drupal.org/project/ctools Google Analytics http://drupal.org/project/google_analytics Masquerade http://drupal.org/project/masquerade Pathauto http://drupal.org/project/pathauto Token http://drupal.org/project/token Views http://drupal.org/project/views Webform http://drupal.org/project/webform

Contributed modules recommended or mentioned:

Chaos Tools with Page manager http://drupal.org/project/ctools Allows a site manager to control the layout of specic pages. Content Access http://drupal.org/project/content_access Global Redirect http://drupal.org/project/globalredirect Imagecache Proles http://drupal.org/project/imagecache_proles LoginToboggan http://drupal.org/project/logintoboggan Mollom http://drupal.org/project/mollom Permission select http://drupal.org/project/permission_select Quicktabs http://drupal.org/project/quicktabs Revisioning http://drupal.org/project/revisioning Rules http://drupal.org/project/rules Site Map http://drupal.org/project/site_map Twitter http://drupal.org/project/twitter Views Bulk Operations http://drupal.org/project/views_bulk_operations Varnish http://drupal.org/project/varnish
4

Drupal 7 in a Day

Views Bulk Operations (VBO) http://drupal.org/project/views_bulk_operations Views Slideshow http://drupal.org/project/views_slideshow Workbench http://drupal.org/project/workbench XML Sitemap http://drupal.org/project/xmlsitemap

Distributions mentioned:

Drupal Commons http://commons.acquia.com/ COD - Conference Organizing Distribution http://usecod.com/ OpenScholar http://scholar.harvard.edu/ (demo) Open Atrium http://openatrium Open Publish http://openpublishapp.com/

Drupal 7 in a Day

Schedule
Depending on your venue, timings may differ. These are only guidelines based on a schedule from 9-4:30pm. While sessions may run longer or shorter, keep track of the break time. Its really important to take breaks, get away from the computers, and stretch, especially in the afternoon! We start with a broad overview and tour, and get successively deeper into each aspect of Drupal as the day continues. Start Duration On arrival 9:30 9:30 0:30 1:00 Session Before we start Introduction Session 1 Description Prepare for the class by thinking of some good questions.

Get set up Why choose Drupal? Who makes Drupal? What's in the box? A hands-on tour

What is Drupal

10:30 10:45

0:15 1:15

Break Session 2

Dont forget to take a break Content management


Modeling data and content types Users and roles Customizing content administration

12:00 1:00

1:00 1:30

Lunch Session 3

If its nice outside, go for a walk. Site building with Drupal


Content display with Views Information architecture (Paths, URLs) Block placement and layout Navigation

2:30 2:45

0:15 1:00

Break Session 4

You might need some tea or coffee! Extending Drupal


Modules: Can Drupal do X? Themes: How your site looks Distributions and Installation proles

3:45

0:45

Session 5

Review and wrap up


You have a new client! Apply what you learned in a new situation

Drupal 7 in a Day

Before we get started


By the end of this course, you will understand how many Drupal sites are built. At the beginning of this course, your instructor will show you some Drupal sites. They may seem like a mystery at rst. Right now, you may not even know where to start with Drupal. A great way to learn is to actually get yourself quite confused. Form good questions and you can get the right answers to help you.

Form some good questions


Take a look at popular Drupal sites listed at http://drupalshowcase.com/ Pick a few sites that look interesting to you. Explore how the site operates.

Select a few details to inspect closely and come up with some specic questions here are some examples below. Make note of your questions on a blank page of this manual.

Consider functionality: What kind of functionality does the site offer you as a visitor? Can you login? What additional abilities do you have? How can you interact with the site? Consider content: Can you see portions of the content, such as a title or summary on one page, with a link to a full page? How is the content displayed? Consider the navigation and layout: How do the menus and areas of the pages divide content and attract your attention? How did they arrange the content in the areas on the pages? How did they manage the menus? Consider the look of the site: How is the overall design unied? How does the use of graphics or colors make the site pleasing and unique?

As a review at the end of this course, come back to the sites you identied to see if you can answer your own questions!

Drupal 7 in a Day

Session 1: What is Drupal? Unit 1.1 - Drupal's strengths


Drupal is a modular content management system that enables site administrators to:

Organize and display content. Customize site appearance. Manage routine tasks such as site registrations. Manage users by individual accounts and by roles such as members. Apply granular administrative and content permissions.

The Drupal framework is open-source, and therefore the source code behind it is available to anyone interested in modifying or developing it further. Drupal has grown in leaps and bounds over the last few years powering everything from small blogs to Whitehouse.gov. This growth is due in part to Drupals unique strengths, which include:

Community Drupal is supported by a vibrant and talented development community. Custom content types and elds the ability to build and modify content types. Taxonomy provides unlimited, multilevel categorization of content. Views controls how lists and tables of content are displayed. Caching Drupal's caching tools greatly enhance page load times. SEO friendliness - Drupal's clean URLs feature packs a mighty SEO punch.

Unit 1.2 - Whats in the box? Take an administration tour


To login to your Drupal site go to http://example.com/user and enter your user name and password. Note: example.com is used in documentation, however your site might be at site.localhost Well take a tour section by section.

Drupal 7 in a Day

You are logged in as the superuser also known by the alias user/1. As this superuser you have access to all the controls to customize your website.

The overlay can be turned on and off for different kinds of users. By default all of the administrative functions are performed in the overlay. This is provides a consistent administration experience for all Drupal 7 sites, and makes a clear separation between what visitors see and what site administrators see. You can also turn off the overlay entirely, and change the look of the admin area. The admin bar shows the top-level categories of all admin functions on the site. A user will only see those options that they have access too. The shortcut bar can be customized and different sets can be created. Users only see links they have access to. Note that the save button in Drupal is located at the bottom of each page usually!

Were about to take a whirlwind tour through all of the main sections of the Drupal administration area. This is going to go by pretty fast. Keep in mind, were going to dig deep into each of these sections throughout this course- so do keep track of some of your burning questions.

Exercise - Customize the shortcut bar

The shortcut bar can be customized. You dont need to make user-specic menus. Drupal is rather clever about menus. Users will only see the links to functionality they have access to. Meaning, if you added a link to Date and time settings, only administrators with the right privileges could see the link. 1. Click Edit shortcuts to manually add links. 2. As you browse click a + sign in a particular section to add a link to the bar.
9

Drupal 7 in a Day

By altering the shortcut defaults you can create a new Shortcut set. Users can choose from a variety of shortcut set options, or be allowed to create their own. To give the correct permissions at Navigate to People > Permissions > Shortcut Select any shortcut set.

Dashboard

The tour starts at the Dashboard. This is a quick-start area for users of your site. What links a user sees are limited by the users permissions. This means it will automatically generate a user-role specic dashboard. You can drag and drop blocks into the Dashboard.

Content
This section will show a list of added content. In the section tabs, you can also locate comments. Keep an eye out for additional tabs that appear here as you extend your site with modules.

Exercise - Add content


1. Go to Add content in the shortcut bar. Choose Article from the Add content options. 2. Fill in the Create Article form with the following settings (or something similar).

Title: What not to pack Image: If you have an image you can upload one. Tags: travel tips, packing Body: Fill in some sample text.

10

Drupal 7 in a Day

3. Scroll down and Save.

4. Now revisit your Content listing at Find content in the shortcut bar. You can see your article there.

Structure
This section includes the building blocks of your website: whether is it containers for content (content types), saved queries (Views), or navigation control (blocks and menus). Keep in mind that new administration pages will become available in this area as you extend Drupal with new modules.

Exercise - Add a welcome block


1. Go to Structure > Blocks and click + Add block 2. Fill out the form with the following settings.

Block description: Welcome message. This helps site administrators know what the blocks purpose is on the site. This text will appear alongside the block on the block admin page and will not be displayed to users. Block title: Welcome to GlobalTravel.com. In the case that you do not want to add a title to your block, enter - <none> in the block title eld, or leave it empty. Block body: GlobalTravel.com is your one stop shop for all your travel needs. This will be the actual welcome message text in the block.

11

Drupal 7 in a Day

3. Review. Your block form should look like this now.

4. Next well assign this block to show up on your site. Scroll down to the Region Settings section. Under Bartik select the Sidebar rst region from the default theme regions select list. As the welcome message is intended for site visitors, well leave the admin theme region settings at the default of None.

5. Now well congure the visibility settings for the block. Drupal allows you to specify on what pages your block is displayed on, with which content types it appears with, and to whom it is displayed. We only want our Welcome Message block to appear on the front page.

Under the Pages section of the visibility settings, select Only the listed pages.

12

Drupal 7 in a Day

Enter the text <front> in the space provided.

6. Save block. 7. Navigate to the front page of your site to see the new welcome block in the rst sidebar section of the page.

Challenge exercise - Compare!


Go to Find content in the shortcut bar. Did you expect to see the welcome block in the list of content?

Appearance
The look of your Drupal site can be changed entirely through the use of templates in the Theme System. In Appearance you can see the default themes included. You can add more, customize
13

Drupal 7 in a Day

existing themes or create your own. Lets see how we can alter theme settings to change the look of the site.

Exercise - Theme settings, Hide the logo


Close the overlay. Youll notice, by default you have a logo appearing in the header of your site.

1. Go to Appearance, and click the Settings tab. Under Global settings > Toggle display deselect Logo.

2. Click Save conguration. 3. Close the overlay. Now the logo is gone. This toggled the display of the logo.

People
This is where you can create user accounts, and manage permissions. Note that you add and manage Roles under the Permissions tab.

Exercise - Check your user account.


1. Click your username in the upper right hand corner. This is your user account prole. 2. Click the edit. This loads the account editing page. Here you can change your password, or upload a picture of yourself. There is no need to make changes at this time.
14

Drupal 7 in a Day

Modules
From this listing you can enable and uninstall additional scripts called modules. We will do more activities with modules soon. Notice for many modules there is a quick link to help, or to modify permissions, or to congure the module. A good practice is to disable any modules which arent in use to free up resources.

Conguration
Here you see a list of main operations such as managing search, regional settings and overall account settings. Lets change a conguration option to see how this works.

Exercise - Site conguration: Change your site title


One of the greatest advantages to using a CMS instead of maintaining a static HTML site is that so much of your web site can be changed instantly by interacting with your site through a browser. 1. Go to Conguration > System > Site information. Here you can change your site title, and your default front page. The title of your site will appear in the title bar of your browser and in search engine results. The slogan will appear on the front-page title bar, and under the heading of the site. What will you call your new site? Examples: Site Name: Global Travel Slogan: Go where you want to go 2. Click Save conguration. After you save you will get a conrmation message. What does it say?

3. Close the overlay by clicking X. Youll notice the page refreshes and title of the site has changed. Much better!

Exercise - Optional: Enable Clean URLs


If you click on My Account in the upper right hand corner, you can see your user account page. This is where you change your password. Notice the URL path in the browser. If your site looks like http://example.com/user then youre all set and you can skip this exercise. If yours looks something like http://example.com/?q=user - then you will need to enable clean URLs. The query: ?q=user is requesting that Drupal return the related page. However, thats pretty ugly, isnt it? Lets enable clean URLs. 1. Go to Conguration > Search and metadata > Clean URLs
15

Drupal 7 in a Day

Select Enable clean URLs. Save conguration. 2. Close the overlay and return to your account page. What does the URL look like now?

Under most circumstances, your server should be congured to handle clean URLs. If not, please refer to the Drupal.org documentation. http://drupal.org/getting-started/clean-urls

Reports
Drupal keeps some basic statistics about your site here.

Choose Status report from the report options. Are there any tasks you should complete? Click on the Recent log messages. Have you generated any errors yet on your site? Scroll down to nd Update notications. Do you see a warning?

Exercise Enable update status


This module sends and receives important installation about the modules installed on your site. Drupal.org uses this info to track how many times a particular module is installed on a live site. It also sends you valuable information telling you about available updates to your modules. 1. Click on the link in the warning to go to the module administration page. 2. Locate the Update manager in the listing of modules. 3. Select Update manager. 4. Scroll down and click Save conguration. 5. Go to Reports > Status and check the status of Update notications. The warning should be gone! Now your site will monotor what updates are available for you, and assist you in installing modules

Help
This area is a summary of all the help information about any modules you have on your site. There are also quick links to relevant handbook pages on Drupal.org. You may also nd these modules useful while you're learning: Module name Advanced Help Description http://drupal.org/project/advanced_help For additional help, some modules employ the Advanced help tool. This provides in-context help. http://drupal.org/project/tutorials This module embeds contextually relevant tutorials into your Drupal site from Tutr.tv.
16

Tutorials module

Drupal 7 in a Day

Unit summary
In this unit you learned more about Drupal as a content management system. You did some exercises to see how you can quickly change the look and information on your site, as well as create a custom experience for users.

How does Drupal compare to a static HTML site? What other content management systems are you familiar with? What are some differences you see? Look at some of the sample sites shown by the instructor in the presentation. Write down some questions about how the site was put together. Look at the menus, the blocks of content, and the layout. Lets see if you can answer these questions later.

Unit 1.3 - Common modules and conguration


There are thousands of Drupal modules that extend the default functionality of Drupal. In this session you will understand:

The difference between core and contributed modules. How to identify and assess healthy modules. They are not backward compatible but upgrade paths dont break data.

Presentation: What are modules?


Modules answer the question... Can Drupal do X? Drupal core is made of a series of required and optional subprograms called core modules. However, Drupal wouldnt be much without contributed modules that extend the functionality of the core modules. For example, the content module can be extended with special types of eld validators and formatters, allowing you to have a link eld on a form, and it will validate that a user typed in a valid HTTP link. As well, Drupal contributed modules themselves wouldnt even exist if it wasnt for the community members. As a rst step in learning about modules, lets connect to the community.

Connect to Drupal.org
Drupal.org is the ultimate place for Drupal. It is where you download projects, collaborate with others, as well as nd and contributed references are resources.

17

Drupal 7 in a Day

Create an account
1. Go to http://drupal.org/user/register 2. Fill out username, password, email address, and country 3. Create new account. Conrm your email. 4. Login to Drupal.org 5. Welcome to the Drupal Community!

Exercise 2:1 Enable and congure the contact module


Now well enable the contact module to make a quick and easy way for visitors to send us messages without exposing email addresses on the site.

A. Enable the module


1. Go to Modules in the admin menu, to view the list of currently installed modules. 2. Select the Contact module. Notice the version number and description.

3. Save conguration. 4. Notice the Contact module listing has new options available. Click Help.

5. Based on what you read in help, do you have an idea of how to use the contact module? 6. As soon as you have the Contact module enabled you can access it at: http://example.com/ contact

B. Congure the contact form


1. Go to Structure > Contact form 2. Locate the default category Website feedback. 3. Click edit.
18

Drupal 7 in a Day

4. Modify the Recipients and add in multiple email addresses using a comma. 5. Add an Auto-reply message: Thank you for contacting us. We will respond shortly. 6. Save

C. Test the contact module


1. Go to http://example.com/contact 2. Test out the contact module by lling in the form and submitting.

D. Add a category
1. Go to Structure > Contact form 2. Click + Add category 3. Category: Advertisement 4. Modify the Recipients and add in multiple email addresses using a comma. 5. Add an Auto-reply message: Thank you for contacting us. We will respond shortly. 6. Selected: Select Yes. 7. Save

E. Test the contact module again


1. Go to http://example.com/contact What differences did adding a category make in the form? 2. Next, logout of the site, by clicking the Log out link in the upper right hand corner. 3. Visit the contact form. http://example.com/contact What do you see? Access Denied!! We have to x that. 4. Log back in as the superuser (your default administration account).

F. Congure by modifying permissions


We will delve into users, permissions and security later. In this activity, you can understand how to make your contact form accessible for visitors. 1. Go to People > Permissions (Permissions link is located in a tab) 2. Youll notice there are three kinds of user roles: Anonymous user anyone who is not logged in Authenticated user anyone who is logged in with a user account Administrator a special role with permissions to alter and congure the site 3. Scroll down to review the permissions for the Contact module.

Consider the context of a travel website, which roles should be assigned these permissions? Notes User can alter settings, add email addresses and change messages.
19

Permission Administer contact forms and contact form settings

Which role(s)?

Drupal 7 in a Day

Use the site-wide contact form

User can ll out a contact form and send messages through the site

Send messaged through Users can send direct messages users' personal contact through their account pages. forms 4. Next, you will modify the permissions so anonymous and logged in users can use the contact form. Select the appropriate set of permissions.

" 5. Click Save permissions

G. Test the contact module one last time


1. Test out the contact form as an anonymous user. Logout of the superuser account, or use another browser. 2. Go to http://example.com/contact and test again! What differences do you notice?

Challenge exercise: Additional core modules to explore


The contact module was a quick solution to extending the functionality of your Drupal site. By enable the contact module, we were provided with a form to congure, and we could control who could use that form. There are several powerful core modules that will allow you to quickly extend what Drupal can do. Try out these core modules: Module name Aggregator Forum Description Allows you to import content from external RSS feeds. This provide containers for discussion topics and threads. The formatting of the Drupal core forum module is not similar to many common forum packages. Creates a poll content type. Users can vote on polls and see results in a simple graph. Generates a list of a users contributions accessible from a tab on the users prole. You can also modify permissions to control who can see the tracker on the users page.

Poll Tracker

20

Drupal 7 in a Day

Unit summary
You enabled a core module, contact, and added specic functionality to your site. The great thing is, you dont need to have all modules enabled.

Unit 1.4 - Installing modules


You have seen how enabling and conguring a core module can extend the out of the box functionality of Drupal. However, there are many more possible ways to extend Drupal with contributed modules. These are sometimes referred to as contrib. We will see two options for installing modules.

Option 1: Using the Update manager Option 2: Installing manually

Refer to the Appendix for a quick reference on Evaluating Drupal projects. If possible, you can try out both options, and install both modules.

Option 1: Install the Masquerade module with the Update manager What is the Masquerade module?
Masquerade is a module that allows you to switch between users. This is a valuable tool during development, as well as a way to investigate user error reports. By default, the permission to masquerade as a user will be limited to Administrators. The illustration here shows the block that is available after you enable the module.

A. Enable the update manager (if you have done this already, skip ahead!)
Drupal also has a tool to make updating and installing modules easier from the browser. 1. Enable the Update Manager. Go to Modules and select the Update Manager module. Save conguration to enable. 2. Check for updates. Click the new Update tab. At this point, you can check manually to see if you have to update any modules.

21

Drupal 7 in a Day

B. Install a new module using the update manager


1. In another browser window visit the Masquerade module page. http://drupal.org/project/ masquerade On this page you can see some essential information about the project.

a. How active are the maintainers? b. Is there a stable version available for your version of Drupal (Drupal 7)? c. What is the maintenance status, and how many reported site using this module? d. Also good to keep an eye on the ratio of open to resolved issues.

22

Drupal 7 in a Day

2. Scroll down to locate the project download links. Locate the latest 7.x recommended release. Copy the link from your browser.

3. Now return to your websites Module listing. 4. Click the new option to + Install a new module. 5. Paste in the link to the compressed module directory. (Double check: The le should have an extension such as zip tar tgz gz. You can of course upload a le as well. ) 6. Click Install.

Challenge exercise: Install and congure Masquerade


After you install Masquerade, the module appears in your module listing. Locate it, select to enable it, and Save conguration. To enable the block, go to Structure > Blocks and locate the Masquerade block. Use the pull down menu to select Sidebar rst to make the block appear there.. Later, when you have additional users you will be able to type in their usernames here. After youre done testing you can switchback.

23

Drupal 7 in a Day

Dependencies When you go to enable the newly added module, you may notice a series of dependencies. These are highlighted in red as (missing) or (disabled). If missing, you will need to install the modules. The titles of the modules, with underscores if they have spaces, can help you get a quick link to the related project. For example, just add the name to the end of the URL for projects: drupal.org/project/Form_builder If they are just disabled, you will only need to enable them. If you need to, repeat the steps for installing a module for all the dependencies.

Option 2 - Manually installing a module What is the webform module?


On our clients site, they would like to have forms to allow potential customers to ask about their services. Webform allows you to make custom forms with drop-down menus, checkboxes and more.

A. Search and download


For this exercise, we are going to download the Webform module for Drupal 7 from the Drupal.org modules page. 1. Visit the Modules search page http://drupal.org/project/modules. 2. Filter by compatibility: Select 7.x. Drupal modules are not backward compatible. 3. In the Search Modules text eld, enter Webform and hit Search. Locate the Webform module in the results. 4. This should take you to the Webform project page http://drupal.org/project/webform 5. Refer to the Appendix for advice on evaluating Drupal projects. 6. Scroll down to the Downloads section. Youll notice that there are 2 recommended releases for this module one that begins with 6.x and one that begins with 7.x.

We are only interested in the Drupal 7 version, so click on the download link for this version to download the module.

B. Manually install the module


1. Unarchive (unzip) the Webform folder into the contributed modules directory of our site sites/all/modules. Now the path to the module is sites/all/modules/webform. 2. Go to Modules page of your site and refresh to see the webform module listed.

24

Drupal 7 in a Day

C. Enable the modules


1. In the Modules list, next to Webform, select Enabled. 2. Click Save conguration. A message at the top of the page The conguration options have been saved, conrms that your module has been successfully enabled.

Enabling a module does not always make it work automatically. Sometimes permissions and conguration options need to be set as well. On the modules page, you will often see a permissions link and a conguration link next to the module name.

Optional exercise: Uninstall a module


1. Go to the Modules listing page. 2. Deselect the ENABLED checkbox beside the module you wish to disable and Save conguration. 3. Click Save conguration. 4. Click on the Uninstall tab. If you had used the module, added data and disabled the module, the module will appear here in the listing. This will run the uninstall script for that module, if available. 5. Youll notice the module still appears in this list, because the module is still located in that directory on your sites le system. You will need to manually remove the module to delete this module from your listing.

Unit summary
In this unit you saw how you can extend functionality on your site by selecting and installing modules. Well look at modules in more depth later. Think of functionality you would like your site to have. Try to conduct a search for a module on your own before asking the instructor, use all the resources listed above. Ask the instructor for his or her experience with this module, and check if there are any alternatives.

Session discussion
In this session you became familiar with the most important parts of Drupal out of the box. You congured your site, added some content and a user. In addition you saw how you can extend what Drupal can do by installing modules. You saw how you can extend and customize Drupal through selecting the right modules and themes. You saw how the community shares solutions to commons problems with distributions and installation proles. Consider: How is Drupal like a CMS (content management system) builder?
25

Drupal 7 in a Day

26

Drupal 7 in a Day

Session 2: Content management Unit 2.1 - Creating and managing content


Drupal is, after all a content management system. In this session well look at all the aspects of content management, from content types to who is adding and editing content.

Create GlobalTravel.coms about us page


Doesnt every site need an About us page? Since its not necessary to provide site visitors with the ability to post comments, the Basic Page content type is a perfect t for the job.

Exercise - Step-by-Step Author basic content


Earlier we created an article without reviewing the options. Lets go through this step by step. 1. Click on Add content in the admin menu and select the Basic page content type. 2. Enter About us in the title eld. 3. With the title taken care of, let's move on to adding the actual content of our page. Enter the following content into the body section:
GlobalTravel.com is the worlds best travel website providing travel enthusiasts all over the world with everything they need to research, plan, and book their comprehensive travel needs.

4. Check the text format. This content can either be in plain text or HTML. If entering HTML, please take note of the Text format option under the body eld. If this is set to Filtered HTML, then only HTML tags that have been dened by a site administrator will work. If it is set to Full HTML, then all HTML tags will work. If a user has not been granted access to Full HTML by a site administrator, then the Full HTML option will not be listed under this section. Text formats might seem a bit confusing now, but they are one way your Drupal site stays secure. 5. The next thing we want to look at is the Menu settings section. Scroll down to the advanced settings.

27

Drupal 7 in a Day

As this is an About us page, we will want to give the page a menu link so that users can easily access it. Once the page has been saved, this will place the About us menu item in the Main menu, which is usually located just below the header of a site. Select Provide a menu link. By default the title About us is populated in the Menu link title eld. Enter a Description of the menu item (this will be displayed when a user hovers over the link), such as Find out more about Global Travel. In Parent item the Main Menu option is selected by default. The Weight option determines where your menu item will be positioned within a menu item list i.e. higher numbered items (10) are located at the bottom of the list, whereas lower numbered items (0) are located at the top. We'll leave this at the default setting of zero. 6. We are almost ready to publish our page, however there are a few more sections at the bottom of the page that we will want to check before hand:

Revision information This is for logging notes on revisions or updates that you make to content, and is therefore useful when you are editing existing content. URL path settings Specify a custom URL alias for content. Deselect Automatic alias. Under URL alias enter about-us. This page will appear at a path such as http:// example.com/about-us. Comment settings Enable or disable comments for this piece of content. As this is a static page, we will want to leave comments disabled by leaving the closed option selected. Authoring information - information on the person who authored/created the page, and the date and time it was created.
28

Drupal 7 in a Day

Publishing options this section allows you to specify whether the content should be published or unpublished, promoted to the front page, or made sticky at the top of lists. Leave the published option checked.

Tip: If Published is not checked its unpublished. This is how you keep content in a draft state in Drupal. This sometimes confuses new users. 7. Finally, Save. Close the overlay and go to your home page. Now you should now see a new menu item within your Main menu called About us. If something has gone wrong and you don't see this menu item, you can go to the Content section, which lists all of the content on your site, and look for it there. Make sure to set the link in your main menu.

Optional Exercise - Add an Article (optional if you have created an article in Session 1)
1. Lets see how a different content type works. Go to Add content > Article. Title: Great places to travel! Tags: island, sun, winter Body: Enter some sample text. Leave all other default options. 2. Click Save.

Challenge Exercise - Revisions


1. From the content listing, edit an existing item of content. 2. Under the Revision information tab select Create new revision and write in a log message.

3. Click Save. This will reload the item. 4. Click the Revisions tab. Here you can see previous versions of the content. 5. Click Revert for the previous version and follow the on-screen instructions. You can see your previous iteration was copied rather than overwritten.

29

Drupal 7 in a Day

Compare content types


Go to the content listing and view the basic page and articles. What are the main differences? Basic page Article

Lets look at the difference between these two in their conguration settings. 1. Go to Structure > Content types. 1. Click on edit next to Articles. This loads the edit form.

30

Drupal 7 in a Day

2. Scroll down to the advanced options and click Display settings tab. This is the default setting for the Articles content type. You can also override this when you add a new article.

3. Now compare this to the settings for the Basic page.

Manage content
Go to Content in the admin bar /admin/content. This Content Administration Page displays all of the content on our site and allows us, among other things, to edit or delete any of this content.

31

Drupal 7 in a Day

Filter content and bulk operations


The lter is extremely useful when you have a lot of content on your site and you need to nd specic content quickly. To display all of our content again, we click the Undo button. The lter will persist, so remember to click Reset when youre done.

When you have a lot of content on your site, using Update Options will save you time.

Recommended modules for improved content administration


Later as you become more familiar with Drupal, you may want more powerful tools to manage content. Revisioning http://drupal.org/project/revisioning Congure workows to create and moderate workow revisions. Rules Views Bulk Operations http://drupal.org/project/rules Create automated publishing workows based on site based events. http://drupal.org/project/views_bulk_operations Create custom lists of content and expose administration options to change author, publish status and more. http://drupal.org/project/workbench A simplied interface for content managers, provides access control as well.

Workbench

Unit 2.2 - Designing Content types


The article and basic page content types are sufcient for very small, basic sites. However, as the complexity and variety of your content needs increase, youll want to build your own content
32

Drupal 7 in a Day

types. Content types are one of the most powerful features in Drupal. Drupals content creation tools allow you to create forms containing a variety of elds such as select lists, text elds, checkboxes, image elds, etc. all without writing a single line of code.

Exercise: Create a custom content type


Well make a city guide. These guides will give essential information about visiting these cities. We could use one unstructured text eld, but we gain some advantages with individual elds. We can force the authors to include essential information, and we can control how this is displayed. These are the elds we will have in our city guide form:

City name Description Do not miss Image What to pack

A. Create a content type: City guide


Now well add a new content type to our site: The City Guide 1. Go to Structure > Content types > Click + Add content type Name: City Guide Description: A guide to a popular city. Under Submission form settings > Title eld label: City name. 2. Click Save content type.

B. Test the City guide content type


1. Go to Add content > City guide. You can see a form is available with two basic elds. 2. Fill in the City name and Body eld with your favorite city name and short description. 3. Keep all remaining defaults and click Save. The defaults allow for comments and display the author information. Does this suit City guide content?

C. Edit an existing eld


1. Go Structure > Content types > City guide > Manage elds 2. Click edit for the Body eld. This loads a form to change the body eld only in this content type. 3. Change the label to Description. 4. Scroll down and click Save settings.

D. Add a new eld


1. Go Structure > Content types > City guide > Manage elds (you might already be there!)
33

Drupal 7 in a Day

Under Add new eld, Label: Do not miss Field name: eld_donotmiss Select eld type: Text 2. Click Save and this loads the Field settings Maximum length option. Keep default and click Save eld settings.

3. This loads the settings for this content type. Keep the defaults and click Save settings.

Add an image eld


1. You should be back at Manage elds again. 2. Under Add new eld ll out these options: Label: City picture Field name: eld_citypic Select eld type: Image 3. Click Save and this loads the global Field settings to add a default image. Keep default and click Save eld settings.

4. This loads the eld settings for this content type. Keep the defaults for Allowed le extensions. 5. Under File directory add a subdirectory city guides.

6. Select Enable Alt eld 7. Keep remaining defaults and click Save settings.

Add a multi-line text eld


1. You should be back at Manage elds again. 2. Under Add new eld ll out these options: Label: What to pack Field name: eld_whattopack Select eld type: Long text 3. Click Save and this loads the Field settings with no options. Click Save eld settings.

4. This loads the eld settings for this content type. Under Help text type Put each item on its own line. Under Text processing select Filtered text (user selects text format) 5. Click Save settings.

34

Drupal 7 in a Day

6. The manage elds form should look like this now with all your new elds.

G. Review your content type.


1. Go to Add content > City guide. 2. Test with one of your favorite cities. If you have an image, add one. 3. Review the order of the elds in the form. Does this make sense? 4. Click Save.

H. Re-order the elds in the form.


1. Drag to re-arrange the City picture eld, the Do not miss and What to pack elds above the longer description body eld.

2. Click Save.

I. Review your content type.


1. Go to Add content > City guide. Now you can see the differences in the order of the content as you lled it out.

35

Drupal 7 in a Day

2. Test with another one of your favorite cities. If you have an image, add one.

3. After you save the content type you can see the order of the elds is displayed differently than it was entered. Later we will do more work on how these City guides display.

Unit summary
In this unit you saw the differences between the basic content types, and how you can customize your own with additional elds. The bulk of planning and work you will do on your site is carefully mapping out content types and how they are displayed on your site. You added quite a number of elds already. Consider, if you wanted to change the values of, for example, the salary ranges youll be able to do this easily. Compare that to if you had entered all the data into an unformatted text eld. It took more effort to set up, but will save you headaches in the future. Review the elds you added. Go to Reports > Field list to see a list of elds added to your site. You can use elds across multiple content types, which can offer some advantages because you can edit some global settings and values in one place. Think about a new content type you would like to add to this site.

What display settings suit your content type? What elds does your content type need? When would you use a multiple choice text eld, and when would you use a taxonomy vocabulary with terms? What would be the advantages of either choice?
36

Drupal 7 in a Day

What advantages does Drupal offer when you upload images into a eld, instead of linking to an image directly in HTML?

Unit 2.3 - Categorize content with Taxonomy


Drupal ships with a powerful tool for categorizing and classifying content: Taxonomy. You can have multiple vocabularies that hold various Terms.

Terms Adventurous Vocabulary Audience Budget minded Families High Fliers

Optional exercise: Explore taxonomy


By default, the Article content type comes with a Vocabulary called Tags. Go to Add content > Article. 1. Write in a series of tags such as island, birds, Bahamas. When you add an article, terms can be added in an ad-hoc manner. This auto-complete eld will recommend similar words if they exist. 2. Save to see the article. 3. Locate the tags appear at the bottom of the article. Alternatively, you can control a limited set of terms to be chosen. Lets see how this could be changed. Go to Structure > Content types > Article > Manage elds 1. Next to the Tags eld, click Autocomplete term widget (tagging) 2. Widget type: change to Checkboxes/radio buttons 3. Click Continue 4. Now go to Add Content > Article. See the difference? Now users cannot add new tags, but only select from a limited list. Notice this didnt affect the data or the content. Reset to the default. Go back to Structure > Content types > Article > Manage elds and reset the Tags eld to Autocomplete term widget (tagging).

37

Drupal 7 in a Day

Exercise: Step-by-step - Taxonomy for GlobalTravel.com


In our case we want to categorize content by audience, to help visitors nd relevant content more easily.

A. Create a vocabulary and add terms


1. Go to the taxonomy section of the site Structure >Taxonomy > Click Add vocabulary link.

Name: Audience Description: Who this content is suitable for Save.

2. Our new Audience vocabulary is now listed on the main Taxonomy page. The next step is to add terms to the vocabulary. Click add terms link listed under Operations. 3. Lets add our rst term Adventurous

Name: Adventurous Description: For people who like to try out new places and take some risks. Text format: As we are not using any HTML, change to Plain text. Leave the remaining defaults. Click Save.

4. Saving reloads the form for entering more terms. Repeat the process entering the following terms with a short description for each: budget minded families high iers 5. Click the word Audience in the breadcrumb to go back to see the listing of all terms in the vocabulary. Notice how the terms can be reordered in any arbitrary way, but by default they are alphabetical. You can also drag terms to be child terms of others. In this way, Drupal

38

Drupal 7 in a Day

allows for hierarchical categories. No changes are necessary now.

B. Connect the vocabulary to your content type


Now that our Audience vocabulary contains all of our terms, we need to apply it to the Article content type. 1. Go to Structure > Content types and click on the manage elds to the right of the Article content type name. 2. This opens up the Article content type admin page. By default, the Article content type comes with a Tags taxonomy term reference eld. 3. We now need to add our new Term reference eld in order to associate the Article type vocabulary with this content type. Under Add new eld, complete the elds as follows:

Label: Audience Name: eld_audience Field: Select Term reference Widget: Checkboxes/ radio buttons

Save. This reloads to the eld settings page. Vocabulary: Audience should already be selected. Save eld settings. This reloads to the Article settings page. Select Required eld. Help text: None Default value: None Number of values: Select Unlimited
39

Drupal 7 in a Day

Vocabulary: Select Article Type Click Save Settings.

C. Try out the new vocabulary


To test out our new vocabulary on an Article, edit an existing article. Select a few options and save. Add these same terms to a few other articles. When you view the articles and click the terms what do you see?

Challenge exercise: Add vocabulary to city guides


Edit the City guide content type. Add the existing eld: Audience vocabulary to the City guides content type as well.

Unit summary
You have seen how to relate content across the site. When you click the terms your see a list of related content generated, for example at a path like /audience/adventurous. Note at the bottom of the page, you will see an icon for an RSS feed for that term. How could you change the taxonomy term entry into to a drop-down menu? Or radio buttons?

Unit 2.4 - Manage users


Depending on your site, you may only have a few user accounts for those who manage a site or you may have hundreds of thousands of active members. Here are some key terms:

Account settings: Control whether anyone create an account on your site, or if users need administrator approval. User accounts: When someone registers with a unique email address. User proles: Add elds to allow users to provide additional information. Roles: Make custom roles to organize users into groups to which you can assign permissions and access rights. Permissions: Control which roles can create content, or use module-specic functionality like the contact form.

Security note: The basic rule of thumb when it comes to users is to apply "Least privilege"
40

Drupal 7 in a Day

Give as few permissions as possible to get the job done. Only grant the roles that they need.

It is therefore extremely important that you make use of Drupal's User Role and Permissions features to eliminate the possibility of unscrupulous users taking advantage of security vulnerabilities on your site.

Modules to improve user management


Imagecache proles

http://drupal.org/project/imagecache_proles Set user prole images across the site, and specify different display sizes for user comment and prole images.
http://drupal.org/project/logintoboggan Improve the registration and login experience by allowing users to register and login instantly; and to login with their email address. You can also place a login form on an Access denied page, and more. http://drupal.org/project/permission_select This allows you select groups of permissions, and check all and uncheck all options per role, making it easier to manage a number of roles to with myriad permissions.

LoginToboggan

Permission select

Exercise: Explore account settings Registration settings


By default, Drupal allows visitors to create accounts, but an administrator must approve these accounts, and account creation requires email verication. Depending on the purposes of your site, you may wish to allow only administrators to register accounts, or to allow visitors to create accounts without needing manual approval. Go to Conguration > People > Account Settings

We want visitors to be able to register for new accounts in order to post comments on the site. However, we want the site administrator to manually approve each account application rst, before granting visitors comment privileges. No changes are necessary at this time.
41

Drupal 7 in a Day

Personalization
In the account settings area you can also allow users to upload images as a user picture, or to enable signatures to be included when posting content. No changes are necessary at this time.

Emails
Finally, in this area you can also modify the email notications which are sent at various events such as Account activation or Password recovery. Review these settings.

Administer roles and permissions (privileges)


In Drupal, roles are a way of assigning specic permissions to a group of users, allowing you to ne tune the security and administration of Drupal. Examples: anonymous, editor, administrator. Drupal's Superuser, or User/1, is similar to the root user on Unix/Linux based servers. This account has permission to perform any action on the site. It is therefore advisable to reserve this user account for technical staff only in order to prevent other users from accidentally breaking your site.
anonymous user/0 authenticated users each with unique IDs super user user/1

site visitor

editor

administrator

Anonymous Authenticated users

Anyone who is visiting your site and is not logged in. Anyone who is logged into your site. You can assign additional custom roles to this kind of user. In the illustration above: site visitor, editor and administrator.
42

Drupal 7 in a Day

Super user

This is the rst account on the site with the user ID: user/1. No matter what you do to permissions, this user will always have all permissions assigned. Only log into this account during development.

Exercise: Step-by-step - Set up a user role and assign permissions


Scenario: GlobalTravel.com needs two user roles on the new site:

Site editor: Can create new content, and edit all content on the site. Site visitor: Can leave comments and use the contact form.

First lets review the default settings and get familiar with the interface and conguration options.

A. Explore current permissions


Its important to note, every time you add or enable a new module or add new content types, it will be added to the Permissions admin page. As new modules, content and functionality is added to the site, you will need to update and amend the permissions. Go to People > Permissions tab. Scroll down to locate your new content type: City guide.

Notice the Administrator role was automatically assigned permissions to the default content, but not the new content types. When we added the content type, we didnt change these permissions. Therefore, depending on whether you add your roles rst or your content types rst, you will need to check the relevant permissions as the nal stage. You are the Super user! Remember, permission rules do not apply to the Superuser youre logged in as. That account is automatically granted full permissions to all enabled modules. Get into the habit of going to the Permissions admin page People > Permissions every time you enable a new module, or add a content types to set permissions.

43

Drupal 7 in a Day

B. Add new roles


Now, lets create our two new roles Site editor and Site visitor. 1. Go to People > Permissions > Roles. 2. Add a two roles site visitor and site editor. 3. Drag to re-order the roles so they appear in order of most permissions. This makes your permissions page easier to scan.

4. Click Save order.

C. Congure permissions per content type


Each time you add a new content type, a set of permissions can be congured per content type. 1. Scroll down to locate the site content types and review the permissions available for each. Create new content Edit own content Edit any content Delete own content Delete any content 2. The Site editor role will only be assigned to a few select people who need overall control over the site content. Therefore, which permissions should they be assigned? Lets give the site editors these permissions... for each content type.

Create new content Edit any content Delete any content 3. Select to give administrators the all permissions.

4. Double check to ensure you have not accidentally selected any of the other permissions and then
44

Drupal 7 in a Day

5. Click Save permissions.

D. Congure permissions per module


Each time you add a new module you will come and check permissions. Ensure that you do not give each role more permissions than are necessary. It is therefore important to remain focused at this stage of conguration, and to triple check the permissions you assign to each role.

As a rule, we are choosing to give the Administrator most permissions. This will allow for most work to be done without needing to resort to the super user account. Site editors, a trusted role, are being given access to some administration functionality, such as the overlay and the toolbar. They should also be able to manage taxonomy terms and approve comments.

Use the table below as a guide. Any permissions not listed here can remain as the default settings. Permission Comments Contact Administer comments Use the site-wide contact form Use users' personal contact forms Contextual links Overlay Path Search Use contextual links Access the administrative overlay Create and edit URL aliases Use search Use advanced search Taxonomy Administer vocabularies and terms Edit terms in Audience X X X X X X X X X
Site visitor Site editor Administrato r

X X X X X X X X X X
45

Drupal 7 in a Day

Delete terms from Audience Edit terms in Tags Delete terms from Tags Toolbar User Webform (depends if you have this module enabled) Use the administration toolbar View user proles

X X X X X

X X X X X

Access all webform results

Review all the permissions you have assigned and click Save permissions when you are done.

Exercise: Create user accounts


It is extremely important to test out new roles for security vulnerabilities before moving a site into production. Now well create two new test user accounts for this purpose, assigning one the role of Site editor, and the other the role of Site visitor. 1. Go to People. Click the + Add user link at the top of the page.

2. In the Username eld enter testeditor. Make note of the email and password you entered. Tip: Drupal does not allow you to use the same email address twice. You can add a +1 before the @ symbol in an email. This allows you to create multiple accounts with the same email. Such as email+1@example.com and email+2@example.com. 3. Under Roles select site editor. Take a moment to notice, the authenticated role option is selected by default. This is because every registered user is by default, an authenticated user, and will be assigned the basic permissions that come with this role automatically. Any additional authenticated roles that you create i.e. the Editor role, will inherit the permissions set by the authenticated

46

Drupal 7 in a Day

user role. You can edit the permissions for the authenticated user role on the permissions admin page /admin/people/permissions. 4. Click Create new account. 5. Now, repeat the same steps in order to create our test Site visitor account, using testvisitor 6. Make a note of the username and password and click Create new account.

Exercise: Test user roles


The next and nal step is to test each of the new roles by logging in as the test accounts.

Option 1: Logout of the superuser account, and log back in again as testeditor. Option 2: Open another browser and login as one of the test users. Option 3: If you have the Masquerade module installed from Session 1, use that to switch users.

As you view the site in the different roles, what differences do you notice on the site? 1. Navigate to an article and scroll to the bottom of the page. You should see an Add new comment form. Go ahead and post a new comment and save it.

2. Click around the site checking to ensure that you do not have access to anything that you shouldn't have access to as a Site visitor. 3. If all is good, logout and revisit the same article as an Anonymous user to ensure that you cannot post comments on this page. You should see a Login or Register to post comments message in the bottom of the page. 4. Now to test the Site editor role. Login to the site using the testeditor user account we created earlier. What differences do see on the site now? What you test will depend on what operations this user should be able to perform. For example, now you can see the content listing and you are able to edit and administer the content. The same methods we used to check permissions for the Site Visitor role can be applied here also. However, you will have more options to check and you will want to conduct a lot more tests (i.e. creating, deleting, and editing content, etc.). For both roles, you will want to be extremely thorough in your testing.

Unit summary
In this unit, you saw how to group users into roles related to their level of access and control. You saw how you could control user account creation and control the privacy of your site through permissions.

Think of a website you would like to make. What Account settings would you use? Do you want people to be able to create an account and begin to use your site?
47

Drupal 7 in a Day

With many roles, the management can become tricky. What is the least amount of roles you could use on your own site? What are some things that can go wrong with permissions when you are adding new content types to your site?

Session discussion
In this session we designed a content type. We can think of any site in terms of the content types available. What kind of site are you making? Think of a content type and consider what elds or taxonomy terms you will use. Consider these examples. What kind of elds could be used? What input widget and which could be taxonomy terms?

Course: Title, description, level, pre-requisites, subject area. Portfolio: Title, image, medium, size, genre. Recipe: Title, ingredients, directions, cuisine.

You also saw how content management depends not only on the design of content types, but also the permissions you set for who can manage the content. We broke this down into two distinct steps so we could take a moment to explain the users and roles functionality in Drupal. However, in the future, whenever you add new content types, you should always check the permissions.

48

Drupal 7 in a Day

Session 3: Site Building with Drupal Unit 3.1 - Create lists of content with Views
What is Views?
Further information available at http://drupal.org/project/views. Views is one of the most popular contributed modules, and is used on many sites to select content, sort and display in various ways. Views allows you to create and save named queries of your content, and control how the content is presented. Some examples:

You could create HTML lists of all content titles linking to the full page. You could create a list of city guides. You can also create lists of taxonomy terms, users and comments, and sort in various ways.

Content
Pet-friendly holidays for the whole family. Drum and dance in Mali. Indian adventure on a river boat cruise. Mud baths and hot springs of Beppu. Hidden Paris by night in the winter.

Users
E. Webb
Germany

Taxonomy
adventure budget minded

Comments
Wow, can't city breakwait to get started.

johan 8 Sept

J. Beeman
Spain

families high iers


isabell 8 Sept

Me too!

Before we start
Depending on your set up for your course, you may need to install these modules and enable them.

Chaos tools http://drupal.org/project/ctools Views http://drupal.org/project/views Views UI (included in http://drupal.org/project/views)

Exercise: Step-by-step - Create a content View


Scenario: On GlobalTravel.com we need a page listing all city guides. 1. Go to Structure > Views and click + Add new view. 2. Fill out the form with the following settings:

View name: City guides Show content of type City guide sorted by Newest rst

Create a page should be selected by default. Keep the page title and path defaults.
49

Drupal 7 in a Day

Under Display format: Unformatted list of teasers without links and without comments Select Create a menu link. And main menu will be selected by default.

3. Click Save & exit. 4. Now, when you return to your front page you will see a city guides menu link and the teasers.

Challenge exercise: Modify the teasers


You can control what displays in a teaser by changing the display options directly on the content type. 1. Go to Structure > Content types > City guide. Select manage display.
50

Drupal 7 in a Day

2. Click the Teaser tab. You can see the city pic is hidden. Drag this to the top area to make it display. Label: Select Hidden. 3. Click the gear to open the Format settings for the city pic Image.

Image style: Select thumbnail. Link image to: Select content Click Update. 4. Drag the City picture to above the Description and then click Save.

5. Now view your City guides page. How does it look?

Exercise: Step-by-step - Create a list of taxonomy terms


Scenario: We need a list of the different Audiences to help users nd relevant content quickly.

A. Create the View


Views is quite powerful. In addition to content, you can also list comments, users, les, taxonomy terms... and more options become available as you install other modules. 1. Go to Structure > Views > + Add new view.

View name: Audience Show Taxonomy terms of type audience sorted by Unsorted

2. De-select Create a page. 3. Select Create a block.

Block title: Audience


51

Drupal 7 in a Day

Display format: HTML list Items per page: 5 4. Click Save & exit.

Place the block


1. Go to Structure > Blocks 2. Scroll down to the Disabled blocks section at the bottom of the page. Locate the View: Audience block. 3. Select to place the block into the Sidebar rst.

4. Scroll back up to Sidebar rst and drag the View: Audience to the bottom of the Sidebar rst list. (what blocks show up on your site depends on which activities you have completed).

5. Click Save blocks. Now you will see your block showing up in the sidebar.

Exercise: Step-by-step - Make an author block


Weve seen how we can list content and taxonomy terms, we can also create a block and display some more information about the author of a an article.

52

Drupal 7 in a Day

A. Prepare the site


You will get more out of this activity if the user accounts also have prole images. Edit the proles of the Site admin, the Testeditor and Testvisitor. Add in images to be prole images.

Next, modify the authors so there is some variety. To do this, edit the existing articles and city guides. Scroll down to the Authoring information tab. And type in the names of the other users.

B. Add a new View


1. Go to Structure > Views and click + Add new View 2. Fill out the form with the following options:

View name: About the author Show Users sorted by Newest rst De-select Create a page Select Create a block. Keep the defaults. Click Continue and edit

53

Drupal 7 in a Day

This now loads the full Views editing screen. This illustration correlates to the steps outlined below.

54

Drupal 7 in a Day

C. Add elds to the View


This is now your rst time seeing the advanced options available in Views. 1. On the left, locate the options to edit elds. Click Add 2. Select User: Picture 3. Click the Add and congure button. This loads the next screen to Congure the eld. 4. De-select :Create a label 5. Click Apply all displays. This closes the screen. 6. Look down in the Preview. You will see all your users appearing in a list. Were getting closer!

D. Modify the number of records showing


1. Under Pager click the option to modify Use pager: Full. This open a window. 2. Select Display a specied number of items. 3. Click Apply all displays. This loads the next screen. 4. For Items to display: 1. 5. Click apply all displays. This closes the window. Check your preview!

Make the display dependent on the author of the content (contextual lter)
1. On the right hand side, click to expand Advanced. Next to Contextual lters click add. 2. This loads a long list of options. Use the search eld locate user ID

Select User: Uid Click Add and congure contextual lters. This loads the next screen. 3. Select Provide default value. This opens some additional options.

Under type: Select User ID from URL Select Also look for a node and use the node author.

4. Click Apply to all displays.


55

Drupal 7 in a Day

5. Youll notice now that the preview isnt displaying anything. Type in an argument. For example, 1 (which was the rst node created on the site). Or 7 (if you have a node with that ID). This should display an author. 6. Finally click Save at the top of the Views editing screen. Were nearly done.

F. Place the block!


Now we can congure the block to display on Articles or Travel guides. 1. Go to Structure > Blocks and locate the disabled block View: About the author. Use the drop down menu to place it into the Sidebar second. Click Save blocks. 2. Next, scroll back up to the View: About the author block and click congure.

Scroll down to the Visibility settings. Select Article and City guide. Click Save block. OK! So go back and check your site. You should see the block appearing next to articles as you planned.

Grant anonymous users the ability to see user proles.


Everything looks ne until you logout of the site or check the site as an anonymous user. Can they see the block? 1. Go to People > Permissions 2. Scroll down to locate View user proles. 3. Select to allow Anonymous and Authenticated users to View user proles.

4. Scroll down and click Save permissions.


56

Drupal 7 in a Day

NOW! Go and check your site.


The About the author block should show only on city guides and articles. It should be visible to anonymous and logged in users. How could you improve this? Maybe adding additional prole elds to the users accounts?

Challenge exercise: Make a Travel articles listing page and block


Add a new view to list Articles with a page at the path travel-articles. Try making a page as well as a block. What other ways could you list the content?

Unit summary
Views is a powerful tool for listing content. You have seen how you rst select a base table, whether that is Users, or taxonomy terms. The basic options are powerful enough, and you can also get more specic with the full Views editor. If youre familiar with writing your own database queries, this will look like a pretty handy tool. It also means someone without coding experience can gather complex queries of content and control how they display. Weve only scratched the surface of how you can display various elements of your site, whether its content or terms. Many other options are available.

Unit 3.2 - Information architecture


Paths and URL aliases
When you add content to your site, Drupal automatically assigns a URL to it that uses the following format content/item-title. This may be useful for many generic purposes, but perhaps you could like to customize the paths. The Path module adds a URL path settings tab to the node creation form that allows you to optionally create URL aliases for your pages. This not only makes your URLs more userfriendly, but also scores you SEO points as search engines give better rankings to pages that have user friendly URLs.

Exercise: Step-by-step - Create a URL alias


We are going to create a node of the type Basic Page, and assign a descriptive URL alias to it using the URL path settings provided by the Path module. The Path module is enabled by default, so we dont have to visit the Module Admin page to enable it. 1. Go to Add content > Basic page. 2. Title: FAQ, and add some dummy content to the Body eld. 3. Well provide a menu link for our content so we can navigate to it easily via the Main Menu. Under Menu settings tab, select Provide a menu link option under Menu settings.
57

Drupal 7 in a Day

Leave the default Menu link title Description: Frequently asked questions Parent item: By default Main menu has been selected. 4. Next, we are going to dene our URL alias. Under URL path settings tab, de-select Automatic alias (This option appears if you already have Pathauto enabled).

URL alias: faq

5. Click Save. 6. Navigate to the newly created FAQ page. You should notice that the node is now using the URL alias that we just assigned to it - http://example.com/faq

Patterns, tokens and the Pathauto Module


The Path module serves our needs well for individual nodes. However, what if we need to apply a specic URL format to all posts of a specic content type? For example you may prefer different patterns depending on the content type. Then at the top level of those paths, you could make a View listing the summary of those sections. Enter Pathauto - http://drupal.org/project/pathauto. The Pathauto module is a contributed module that automatically generates path aliases based upon a pattern system which the site administrator can control via the URL alias admin page provided by the module. Examples:
Views page listing teasers Example Pathauto generated link Pattern token travel-article/ [node:title]

http://example.com/travel-article http://example.com/travel-article/article-title

The second part of this pattern, the [node:title] section, is a token. Tokens are placeholders that allow you to dene dynamic content in this case the node title. Tokens are generated by another contributed module the Token module - http://drupal.org/project/token. The Pathauto module depends on the Token module and so you will need to enable this before you can use Pathauto.

Example: City guide view and each city guide


Lets say you make a listing of all city guides at http://example.com/city-guides And, when you view an individual city guide, you want the path to be http://example.com/city-guides/newcity Now, you can use the /city-guides/ path to control where blocks appear, and how navigation works. example.com/city-guides example.com/city-guides/beppu token pattern: city-guides/[node:title].
58

Drupal 7 in a Day
Web Page Title http://example.com/city-guides Google

Web Page Title http://example.com/city-guides/beppu

Google

Site title
Slogan
(banner)

Slogan
(banner)

City guides Beppu Paris Mali

Login
name password Log in

Login
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia. Separated they live in Bookmarksgrove right at the coast of Semantics, a large language ocean. name password Log in

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, Countries Vokalia and Consonantia, there live the blind texts. Separated they live. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language.

For the traveler Adventurous Budget minded Families High iers

What to pack
Towel Flip-ops

For the traveler Adventurous Budget minded Families High iers

Exercise: Step-by-step - Automatically assign a URL alias pattern to a content type


For SEO and organizational purposes, GlobalTravel.com wants to assign a URL pattern to all of their travel articles. We are going to automatically assign a URL alias pattern to the Article content type so that all Travel Article nodes will be assigned the URL alias format - http://example.com/travel-article/ article-title. Before we begin enable the following modules. If you are using Acquia Drupal, these are installed by default. They are not part of Drupal core installation.

Pathauto http://drupal.org/project/pathauto Token - http://drupal.org/project/token

A. Add a new path alias pattern


1. Go to Conguration > Search and metadata > URL aliases 2. Here you can see each URL alias currently on your site. Review the various paths for content, or taxonomy terms. The permanent links have the full path with an ID. Yours may look different depending on which content you have created.

3. Click the Patterns tab at the top of the page. Under the Content Paths section, youll see the Pattern for all Article paths eld.
59

Drupal 7 in a Day

4. Click to expand Replacement patterns and click to expand Nodes to locate the correct token to use for node titles. This section lists all of the tokens that are available to us for nodes. Locate the title token [node:title]. We will use this in our URL alias pattern. Tip: You can either copy and paste the pattern, or click on the text eld, then click on the pattern and it will populate the text eld for you. 5. Modify the pattern for the Pattern for all Article paths eld, so that it looks like this travelarticle/[node:title]

6. Click Save Conguration.

B. Update existing paths


So that our new pattern will be applied to existing Article nodes that were created before we dened our new URL alias pattern, we are going to Bulk update all nodes on our site. 1. Optional: Delete aliases. If you already had Pathauto enabled before this exercise, you will need to delete the aliases for content, and then do the bulk update. 2. Click on the Bulk update tab at the top of the URL alias admin page. 3. Select Content paths. 4. Click Update. Any URL alias patterns that we dened will now be applied to the existing content on our site. Go ahead and create a few more Travel Articles so that you can see Pathauto automatically adding the new URL alias pattern to the articles once they are saved. Important! If you made manual aliases, such as with the faq page, or if you made any manual links to content, these will be broken. This is a good demonstration of why you need to be careful about choosing aliases, and planning patterns at an early stage in development.

60

Drupal 7 in a Day

Challenge exercise: Add aliases for the City guide content


Follow the steps you used above, and make an alias pattern for city guides so that new city guides can be accessed at links like city-guide/newtitle. Update all the aliases!

Unit 3.3 - Layout


There are various systems for controlling placement of content on areas of your pages. Soon as you become more familiar with Drupal, you will hear about Panels or Context among others. Blocks is the system included with core Drupal.There are two key terms to understand:

Regions are dened in each theme. These are unique areas of the template les into which you can place blocks. Blocks can be positioned into areas of your pages called regions. Blocks, the default system in Drupal, are contained sections of content or data. Blocks are often used to display sidebar information and menus. Blocks can be dened by modules such as the menu system, or they can be created with custom content dened by you.

61

Drupal 7 in a Day
Web Page Title http://example.com Google

Blocks
Site title
Slogan

Site title
Slogan

header

Regions
(banner)

(banner)

Welcome
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

Welcome
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

Sign up
Name

Login
text E-mail sidebar second text name password Log in

main content

A small river named Duden ows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences y into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas.

About you
Vendor Partner Client

Button

Explore blocks
Before we begin building our own blocks, navigate to the Blocks Admin Page. Go to Structure > Blocks at /admin/structure/block Lets get familiar with this page. The block admin page gives you an overview of all the blocks used on a site and the region in which each one will be displayed. 1. Click Demonstrate block regions (Bartik) to see what regions are available. Each theme will be different.

2. Click to Exit block region demonstration. 3. Review the block listing. Notice that in the default theme, Bartik, the search form, navigation, and user login blocks are displayed in the Sidebar rst region. Your block listing may look slightly different, depending on the exercises you completed.

62

Drupal 7 in a Day

4. Drag the User login block to a new position.

5. After you have done this, scroll down and click Save blocks.

Control display of a block


We will take a recent comments block and place it on the sidebar. We will make this block only appear on travel article pages. About disabled blocks: Scroll down to the disabled blocks at the bottom of the Blocks admin page. You can see a variety of blocks available which were created by default. Depending on what modules you have installed, various new blocks will appear here, disabled until you place them. Its always good to check back as you experiment with new modules to see if they are offering you any new blocks of content. 1. Locate the Recent comments and use the drop-down menu to place it in the sidebar rst, or you can drag it. 2. Re-position so Recent comments are at the bottom of the Sidebar rst. 3. Check your front page. If you have comments, you should see this block is appearing throughout your site. 4. Click to congure the Recent comments block. 5. Scroll down to the Visibility settings. Under the Pages tab type in travel-article*

6. This is a great way to control where blocks appear. Look at the options available under content types, roles and users.
63

Drupal 7 in a Day

7. Click Save blocks. 8. Now check around the site. You should see the recent comments only appear on travel article pages. 9. Bonus: edit the block visibility and make this block also appear on city-guide paths.

Unit summary
You saw how you can control where blocks appear on the site. Look at some of the case studies, and example sites you identied from showcase.acquia.com Can you see how these sites were assembled from blocks?

Unit 3.4 - Navigation


As weve been working on the site, weve added some new links to the main menu. Yours may look something like this:

It would make more sense to place the Home link to the leftmost position. We should also include the a link to the contact form.

Exercise: Add an item to the menu manually


If youve completed the exercise to enable the Contact form, you can nd the contact form at the path /contact. 1. Go to Structure > Menus 2. Next to Main menu select add link. 3. Complete the form with the following settings:

Menu link title: Contact us Path: contact

Click Save.

64

Drupal 7 in a Day

4. Return to your home page and you should see the Contact us link now. Your menu might look something like this...

Exercise: Manage an existing menu


Next, lets re-order the items in the menu. 1. Go to Structure > Menus. Under Main menu select List links. 2. Re-order the links with the home link on the top and contact us on the right.

3. Click Save conguration. 4. You can see your menu has now been updated.

Unit summary and review


In this unit you learned how you can get more control over the navigation on your site through the use of the menus. We focused on adding links to the main menu. However you can add custom menus. These become blocks which you can place on your site.

Challenge exercise: Improving SEO


Drupals out of the box structure helps improve SEO (Search Engine Optimization). Adding more structure to your site with things like Taxonomy terms can further improve a search engines ability to make sense of your site. Relevant menu items, like the ones we added, help make the content of your site easier to understand. As search engines become more
65

Drupal 7 in a Day

sophisticated, the simple rule to remember with SEO is - if content is relevant to humans, it is likely to be relevant to search engines also.

Exercise - Google analytics


Google Analytics http://drupal.org/project/google_analytics is a tool for monitoring trafc and the users of your site. This module supplies this functionality to Drupal and allows the site administrator to decide who should be tracked by Analytics to help you get the most useful reports. 1. After you install the module, go to Conguration System > Google Analytics. 2. Enter your unique Web Property ID and Google can begin tracking your pages.

3. Modify Tracking scope. You can also add exceptions to what get monitored. The default exceptions block analytics of visits to administration pages, among others.

4. Save Conguration.

Recommended modules
There are other modules that can further improve your search ranking by streamlining your site for search engines.

66

Drupal 7 in a Day

XML Sitemap

http://drupal.org/project/xmlsitemap Adds a sitemap conforming to sitemaps.org specication to allow the overall structure of your site to be easily seen by a search engine. http://drupal.org/project/globalredirect Search engines dont particularly respond well to duplicated content. Global redirect ensures that paths that lead to the same content are rewritten so that only the best URL available is used.

Global Redirect

Session discussion
Site building requires some forward planning, a good amount of research, and plenty of experimentation. These are the central aspects to site building:

Module selection and conguration Content planning, content type design and display Display and layout Navigation and information architecture

If youre continuing on to the Site building course, you will get more experience with developing unique functionality which you can apply to your own site.

Often developers nd that module selection is the most important part of the process. Well look at this more closely next.

67

Drupal 7 in a Day

Session 4: Extending Drupal Unit 4.1 - Modules Can Drupal do X?


In the previous session you saw the many modules included with Drupal; and how you can extend Drupal through selecting modules. Often, doing the research for module selection is the most important part of your planning process. A good thing to do is to review the case studies on Drupal.org

Drupal.org Case study page: http://drupal.org/cases Acquias case study page: http://acquia.com/resources/casestudies Forums - showcase http://drupal.org/forum/25

In these case studies you can nd reports on how these sites were built. See for example, Symantes case study - http://drupal.org/node/1061630

Case study: Varnish software


Lets look at how Varnish Software manage their website with Drupal. Visit: https://www.varnishsoftware.com/

68

Drupal 7 in a Day

Varnish Software use a variety of modules to get their site looking great with the functionality they need. Here is a selection of modules which you may like to try out.

Chaos Tools with Page manager http://drupal.org/project/ctools Allows a site manager to control the layout of specic pages . Content Access http://drupal.org/project/content_access to get control over who has permissions to see certain content. Mollom http://drupal.org/project/mollom Protects a site against spam with content moderation. Site Map http://drupal.org/project/site_map This module provides a site map that gives visitors an overview of your site. It can also display the RSS feeds for all blogs and categories. Twitter http://drupal.org/project/twitter Provide API integration to display tweets associated with users, and to post tweets to twitter. Webform http://drupal.org/project/webform Used to create surveys in Drupal. Varnish http://drupal.org/project/varnish Provides integration with their Varnish HTTP accelerator.
69

Drupal 7 in a Day

Take a closer look at how their site is organized. Browse through the additional pages, and nd the common elements on each page. By the end of the day today, you will have a good idea of how a site like this is assembled.

Webforms for interaction


Visit Varnishs section on Whitepapers. https://www.varnish-software.com/products-services/whitepapers By using a Webform, Varnish Software is able to gather some information from interested visitors before they download a white paper. Visitors can interact with the site without needing to create user accounts or become members. Using the form, visitors ll in some information about themselves, and then select which whitepaper they would like to download. If you try out this form yourself, youd see that after you ll out your contact details you are given a download link to a special whitepaper. Lets see how would you do that in Drupal.

Exercise: Add a survey to your site


Well add a survey like this one to our site:

70

Drupal 7 in a Day

A. Add a webform
1. Go to Modules and ensure the Webform module (installed previously) is now enabled. 2. Go to Add content > Webform 3. Go to Structure > Content types and you will see a new content type called Webform.

Title: Special offer Body: Please ll out the form below for a special discount code. Scroll down to Publishing options and de-select Promoted to front page Leave all other settings as default and Save. This brings you to the Webform editing screen.

B. Add components and congure


1. First lets add a name eld. In New component name: Your name Type: Select Texteld Select mandatory Add. 2. On the next screen, leave all defaults except for:

Default value: %username (click to expand Token values if youre curious!) Click Save component. This takes you back to the Webform component page. 3. Next, lets add an email eld.

In New component name: Your email Type: Select E-mail Select mandatory Click Add.
71

Drupal 7 in a Day

4. On the next screen, leave all defaults except for: Select User email as default Click Save component. 5. Next, lets add an opt-in question. Can we add them to our mailing list?

In New component name: Mailing list Type: Select Select options Select mandatory Click Add. 6. On the next screen, leave all defaults except for: Options: (safe_key|Some readable option)

0|No, thanks. 1|Yes. 7. Click Save component. Your settings should look like this:

8.

Click the Form settings tab. This brings you to the Submission settings options.

Conrmation message: Thank you. Here is your discount code: TRAVEL123 Click Save conguration.

C. Test
Go to the View tab to see the form and test it. You could of course change the conformation message to include a download link, or add additional elds to gather some more information about your visitors interest.

Challenge exercise: Extending the webform


Option A - Add a link to this webform from the main menu. Option B - Make the form redirect to another page upon submission. Option C - Make a block. Edit the webform > Go to Form settings. 1. Scroll down and click to expand Advanced settings.

72

Drupal 7 in a Day

2. Select Available as block.

3. Click Save conguration. 4. Now, locate the disabled block and place it in a sidebar.

Unit summary
In this session, we extended what Drupal could do by adding and enabling a module, Webform. How is webform different from the default contact form?

Unit 4.2 - Themes


Technically, themes are a combination of template les written in PHP, with additional script and CSS les as well as images. Like contributed modules, you place them in your sites folder so you have /sites/all/themes/yourtheme. Working the Drupal way often means working in an iterative way, and ne-tuning the design at a nal stage of development. Now that we have the site functionality in place we can drape the appearance over the structure of the site. In this session youll compare theme conguration and see whats in the box with a typical contributed theme. These are the same steps you might follow when working on any Drupal site. 1. Search for and select a theme. 2. Download and install. Two options shown here, manually or via the Update manager. 3. Enable and switch themes. 4. Congure and customize.

Compare contributed themes

You can search for themes directly at http://drupal.org/project/themes In the sidebar, locate the Most Installed list of themes. An up to date list of theme services is maintained at http://design.acquia.com/themeproviders

Search for these themes, or ones suggested by your instructor.

73

Drupal 7 in a Day

Marinelli

Fusion base theme

Corolla

Exercise Step-by-step install a theme


Let's learn what a theme is by installing and enabling a new theme on our site. If you have Update manager enabled, you will see a link to + Install new theme. However, at the time of writing this sometimes causes errors with different themes. For now, install manually. Use these instructions for enabling all themes you nd. A. Download a theme 1. Choose a theme from drupal.org/project/themes and download it. Make sure the theme's version compatibility matches your version of Drupal core (7.x). In this example, we're going to use the Busy theme. http://drupal.org/project/busy 2. Locate the appropriate download available from the project page. Download.

B. Place in your theme folder 1. Create a theme folder so you have sites/all/themes/ 2. Unpack the downloaded archive and move the directory to /sites/all/themes/

74

Drupal 7 in a Day

3. You now have all the theme les in your folder. http://drupal.org/project/busy sites/all/themes/busy

C. Enable the theme 1. Go to Appearance and locate the Busy theme under the "Disabled Themes" section.

2. Click Enable and set as default.

Keep in mind, you can have multiple themes "enabled" but not active.
75

Drupal 7 in a Day

3. View your site. You should see some changes. 4. If you have time, try another theme.

Exercise Explore the theme A. Congure the theme settings


1. Go to Appearance and click on the tabs per enabled theme. Some themes will come with more settings, such as color options. Compare the themes you have enabled.

2. In the Global settings, under Toggle display, De-select "Logo", De-select "User verication in comments". 3. Click Save conguration.

B. Compare the theme


Busy theme has a different layout compared to Bartik, and it offers a variety of more options. 1. Go to Structure > Blocks. 2. Click Demonstrate block regions (Busy) and look at the different regions available. 3. Click Exit block region demonstration. 4. Click on the Bartik tab and click Demonstrate block regions (Bartik). What differences do you see? Note: Theme region names are different. This will likely affect block placement. Always check blocks after your change themes.

76

Drupal 7 in a Day

Go to Structure > Block and double check which blocks are displaying. Your block options may be different depending on which exercises you completed.

Optional exercise: Improve site performance


You should only do the following procedure to improve performance when you are nished customizing your site and your theme. You may have noticed, that your site will have many CSS les! In addition to numerous theme CSS les, the system and modules add their own CSS les as well. And each one of those les creates another HTTP request. With so many les to download, you can really slow down your site. Visit the front page, and view the source code in your browser. Try CTRL click or Right click View Page source. Check out how many CSS les this theme includes. Lets x that. Go to Conguration > Performance and scroll down to Bandwidth optimization.

Select Aggregate and compress CSS les. Select Aggregate JavaScript les. Click Save conguration.

Now return to your front page, and view the source. You can see there are a minimum number of CSS and script les now. Much better! Important: Because you are continuing to develop your site. Return to Conguration > Performance and turn the CSS and JavaScript compression OFF.

Uninstall themes
Following a similar process with modules, you rst must disable the theme you want to uninstall. If your theme is currently the default, you cant disable it. Therefore, you have to set another as default. After the theme appears in the disabled section, you can safely remove the theme directory from your le system.

77

Drupal 7 in a Day

Unit summary
As you have seen the theme system is the point where you can gain complete control over the markup and presentation of your site. Youve seen a number of themes available, and how you can explore and try them out.

Unit 4.3 - Distributions and Install proles


Distributions and installation proles are a collection of select modules, some conguration (user roles, permissions) as well as sample content (with vocabularies). With distributions you get a little more, including custom themes and custom modules. Here are some examples:

Commons- Community Powered Innovation


Access controlled groups Discussions Documents/Wiki Members

Conference organizing distribution (COD)


Event sign-up Session proposal Session voting Session scheduling

Global Travel - a new distribution?


City guides Member photo gallery Membership access Webforms

Together installation proles and full distributions provide a packaged solution to make a complex site quickly. If you can nd an installation prole close to your own needs you can save time in getting set up or you can reverse-engineer how they set up the site to learn more. http://commons.acquia.com/ (demo and user community site) A community website based around group memberships.

http://usecod.com Conference organizing distribution - A conference website with various tools http://scholar.harvard.edu (demo) For educational institutions. Includes professor pages, class catalogs. http://openatrium.com/ For making project management sites with task assignments.

78

Drupal 7 in a Day

http://openpublishapp.com/ A solution for newspapers to bridge the gap between paper and online versions. Some agencies have developed entire services and expertise and offer additional paid support. For decision makers this can be a fast track to a complete solution. If youre a developer you might think about how you can make a distribution to share your niche expertise.

Search installation proles


Think about a site you would like to work on. Search for an installation prole or distribution that suits your needs on Drupal.org: http://drupal.org/project/installation%2Bproles You can also download recommended distributions from http://www.acquia.com/downloads.

Session discussion
Drupal out of the box has some good functionality. However its only when you connect to the power of contributed modules that you begin to customize the product that you need. Researching and selecting those modules is an important step of the process. Install proles and distributions might be available to provide a complete solution for you. If not, they might help you identify useful modules. Themes are the last step of the process. In some cases you can use a theme right out of the box. However its likely youll need to do some customization. How you customize those themes will change from theme to theme.

79

Drupal 7 in a Day

Session 5: Practical review. Apply what you learned.


One of the hardest things to do after you leave a class learning new things is to apply them in unique and different situations. Weve tried by looking at case studies to see how Drupal is used in the wild. Now youll start working on a new client site and apply what youve learned.

Grab a partner! You can work with a partner or a small group. Here are two new clients! You can choose between them and use the details here as a guideline. Use your imagination to answer some of the unknowns.

Option 1 - Client Build stuff Scenario: A creative community


Step by step tutorials to excite people about reusing cast off materials in creative ways. Contributors can apply to be tutors and write articles. Contributors can submit videos to demonstrate techniques. Inspiration: .Net magazines tutorials for some ideas. http://www.netmagazine.com/tutorials

Site wireframe:

80

Drupal 7 in a Day

Option 2 - Client Museum of wonderful things Scenario: An online presence for a favorite museum

The is a website for a special bijoux museum. The site helps keeps repeat visitors coming back again, while enticing potential visitors to see what is on offer. Events are highlighted on the site. Visitors can peek a the collection online. Inspiration: Check out Field museums website for ideas http://eldmuseum.org/

Site wireframe:

81

Drupal 7 in a Day

Questions to answer:
1. What contributed modules do you think you will need to install? Do some research, there will be modules you havent tried yet today. Are there Drupal 7 versions of the modules? Are the modules you chose healthy? 2. What user roles will your site need?

3. What content types will the site need? (use the content type worksheet following) What elds will be needed? Who should be allowed to create content? 4. How will the content be displayed?

Double check if there are contributed modules to help control display.

Content type design worksheet


Use this to plan a content type for your new clients site. Steps Create a content type. Questions Title and purpose? Default settings? Comments, show author and date? Add custom elds. What custom data and types? Answer (in this case)

Congure default settings.

Content entry defaults, requirements and values.

Manage display.

How should the content display? Who can add, edit and see this content?

Set permissions.

Test adding content.

Test as various users.

Think of some typical content, will your plan work?

Looking for the Appendix? Download the PDF available at http://tinyurl.com/trainingappendix


82

You might also like