Introducing Good Eatin

Although several books have been written about Drupal, most have been written for developers to help them understand how to build sites with Drupal, enhance sites by using custom modules, and change the appearance of Drupal based sites by using themes. In this book, we take a different approach. Throughout the book, we will develop a web site for a (fictional) business, to meet the needs of this business.

We have included an explanation of all of the key features in Drupal that most small-to-medium sized businesses would want to use on their sites. A thorough step-by-step description of how to integrate each piece of functionality into your web site is included, along with an explanation of the business need that is being satisfied by using the functionality.

After reading this book, you will be able to adapt the techniques used in this book to either develop a site for your company on your own, or work with a development firm to create a web site that truly meets the needs of your business.

In this chapter, we will introduce our client, the Good Eatin' Bistro, and discuss their plans to build a web site. We will also introduce Drupal and describe why it is a good fit for our client's web site.

The Good Eatin' Bistro

Chef Wanyama is the owner of the Good Eatin' Bistro, a popular upscale restaurant. The past few years have been very good, and he has expanded from one restaurant to three. Each restaurant is decorated in a safari theme and Chef Wanyama is extremely proud of the decor. The Good Eatin' Bistro serves a wide variety of food, but specializes in creating meals using exotic game meats.

Chef Wanyama has recently added both take out and delivery to his menu and would like to do additional promotion for this aspect of his business, which he feels will bring in additional revenue. He also gives cooking classes, and would also like to promote these.

PUBLISHING

Chef Wanyama had a web site designed for him several years ago, but it has proven to be difficult to maintain, and is therefore several years out of date. Chef Wanyama would like to build a new web site for his businesses to highlight the new specials at his restaurant. He would like to provide a destination for his customers where they can visit his restaurant online, learn more about the restaurant, find out about specials, and receive discounts if they are loyal customers.

Chef Wanyama has several key goals for his site:

1. The site must be easy to update so that it is always current.

2. Chef Wanyama should be able to make updates to the site without having to pay a consultant to do so.

3. He should be able to delegate simple tasks without compromising on site security.

4. The overall site should be secure and easy to maintain.

5. It should possible to add new functionality to the web site without requiring a complete start over.

After Chef Wanyama came to us expressing his desire to have a new web site built, we sat down with him to determine what pages and sections should be added to the web site, so that we can plan our development. Based on these discussions, we decided on the following structure for the site:

1. Home Page: This includes links to other areas in the site, current events, and sample menu items. Chef Wanyama may want the home page to have a look different from the rest of the site.

2. Menu Pages: This includes food, wine, and cocktails. There will be two methods for creating menu pages: a simple method where each page is developed independently, and a second method where editors can fill in a template for each menu. Each menu item will be categorized, so that customers can search the menu more easily.

3. Menu Search: This allows visitors to search the menu for foods, based on a variety of criteria.

4. Menu item rating: This allows visitors to rate items on a scale of 1-5.

5. About Us Page: This page provides contact information.

6. Guest Book: This allows visitors to comment on the restaurant and give feedback. Chef Wanyama can see when new comments are added, and he can optionally remove comments if they do not meet the site's standards.

PUBLISHING

Introducing Good Eatin'

Plans for a Good Eatin' web site

PUBLISHING

7. Map: This helps the visitor find all of the Good Eatin' restaurants, using Google Maps.

8. Polls and Surveys: From time to time, the restaurant will have polls to see what items patrons want added to the menu, and what they think of the new items on the menu.

9. Picture Gallery: This shows the pictures of the food on the menu as well as pictures of the restaurants.

10. Monthly Newsletter: This is a newsletter that visitors can subscribe to. Chef Wanyama will be able to create the newsletter content on the site. Customers can also view the previous editions of the newsletter.

11. Event Calendar: This showcases musical events and other events occurring at the Good Eatin' restaurants.

12. A Member Rewards site: This gives details of the free meals for members who have visited the restaurant a specified number of times.

13. Online ordering: This will allow visitors to order take out and delivery.

14. Forum: This is a forum to solicit suggestions and ideas for improvement, to discuss policies, and so on.

15. Blog: This will be used by Chef Wanyama and his employees for discussing topics important to them, including information on new menu recipes, running a restaurant, and more.

16. Administration Area: This helps Chef Wanyama optimize his site so that the visitors can make the most out of the web site.

Selecting a foundation for the Good Eatin' site

In this section, we will explore a range of possible technologies that could be used to build the Good Eatin' site. The pros and cons of each method will be discussed, and we will choose the final technology that will be be used to build the site.

Most web sites are created by simply creating standalone HTML pages that do not change. These pages can be created with a dedicated web site design program or with a simple text editor such as Microsoft Notepad. These pages are then uploaded to the web server using an FTP client, or another transfer client provided by the web host.

PUBLISHING

Chapter 1

Simple static web pages

Introducing Good Eatin'_

Key advantages

There are several advantages to using this method of web development:

1. Custom editors can make creating web sites as easy as writing a letter.

2. Web site editors may provide pre-built themes to make the web site appealing without graphical design experience.

3. It is a very easy way to get started.

4. For simple sites, simple techniques are sometimes appropriate.

5. A web site can be created relatively quickly.

6. Sites can be built for free, or for the cost of a web site design program.

7. The hardware requirements are very low, so the web site will run on nearly any host.

Key disadvantages

Although static web pages can be easy to develop, there are a number of disadvantages that appear after you deploy the site and try to make revisions to it later.

1. Adding a new page to the site may require changes to all of the existing pages on the site.

2. Changing elements that are common to all pages, such as the header or the footer, may require changes to every page on the site.

3. When major changes are needed to the web site, it may be easier to start over than to rebuild the site.

4. It is easy to have errors within the web site, leading to pages that cannot be reached, or errors that the visitor may encounter.

5. Advanced functionality cannot be added without custom programming.

6. Created code can be inefficient or incorrect leading to web sites that do not display properly in all browsers.

7. Security and optimization techniques created by other developers are not automatically applied to your site.

Chapter 1

Fully-customized site with PHP and MySQL

At the other extreme of simple static pages is a fully-customized web site built entirely from scratch using a programming language such as PHP and a database such as MySQL. In this type of system, all of the functionality for the web site is built by one or more programmers specifically for your web site. Some common libraries may be used to speed up development, but the majority of the site will be custom-created.

Key advantages

There are several advantages to developing a completely custom web site for your company.

1. The final site will be fully customized to meet the exact needs of your company.

2. New functionality can be added by another programmer at a later date.

3. Complex functionality may be easier to develop when starting from a clean slate.

4. Complex functionality may be impossible to build without custom programming.

5. The site may be much more efficient than a site built on a predefined framework or content management system.

Key disadvantages

Unfortunately, developing a completely custom web site is a difficult, time-consuming process and has several disadvantages. They are:

1. Relatively low-skilled programmers may create a web site that is difficult to maintain and enhance.

2. Changing the look and feel of the site may require significant rework unless the site is designed to allow customization.

3. The site may requires a great deal of work by programmers to create and maintain.

4. Security flaws may be inadvertently introduced, which could compromise the overall server or private data of your customers.

5. The site may require more hardware resources than simpler sites, and may require significant resources to run at acceptable speeds.

6. Creating all of the functionality from scratch can prove to be very costly.

PUBLISHING

Drupal is a content management system based on PHP and MySQL. To use Drupal, you need to install it onto your web server. After it is installed, you use Drupal to create and edit pages. Drupal handles most of the common functionality that is needed to build web sites of any size, including:

• User management

• Categorization of content

• Building menus

• Creating a consistent look for all pages

• Adding pictures to pages

• Creating and maintaining blogs

• Creating and maintaining forums

• Contact forms

• Translation and internationalization

Although these features alone are sufficient to handle many sites, Drupal also offers a powerful module system that allows developers to create modules that plug in to the core Drupal framework to seamlessly provide new capabilities. Many modules have been created by the Drupal community and released for use by other users, free of charge. Modules are available for nearly every conceivable task, but if you don't find what you are looking for, a custom module can always be created to handle your exact needs.

Drupal also provides a powerful theme system that allows you to change the look and feel of your web site and have all of the pages changed throughout the entire web site, instantly. Several free themes are available on the Drupal web site, and these can be customized to fit your needs. Alternatively, you could develop a custom theme for your own site. Commercial themes can also be purchased from a variety of

PUBLISHING

Introducing Good Eatin'

Drupal content management system web sites.

PUBLISHING

Drupal offers a number of benefits not found with the other methods of building a web site. Many of these are related to the ease of maintenance and the ability to concentrate on business functionality rather than building common, repetitive functionality.

1. You are free to concentrate on building content and functionality to support your business rather than creating basic functionality already provided by Drupal.

2. The look and feel of the site can be easily changed without rewriting the entire site or changing all of the pages.

3. All changes to the site take effect immediately, so you can ensure that the changes are correct.

4. Changes can be previewed prior to the web site being updated, to make sure that they work properly.

5. Revisions to pages can be tracked, and you can require pages to go through an approval process prior to being made viewable.

6. You do not have to use FTP or other methods to deploy pages to your site.

7. Development costs are low as Drupal is available free of charge.

8. There is an active community that can help to answer any questions that you may have.

9. Drupal is actively maintained and enhanced, which helps to ensure that potential security issues are rapidly found and fixed.

10. Drupal can be used effectively by a wide range of people, even if they do not have any programming experience.

11. Site management can be delegated to a team of people who can share responsibility for the entire site between them, or take individual responsibility for specific areas within the site.

12. As Drupal is constantly being maintained and updated, you can gain access to new technologies more rapidly than would otherwise be possible.

Although Drupal is a very powerful tool, its very power causes a few disadvantages:

1. A short learning curve is needed to get started and use the system effectively.

2. It is more hardware-intensive than basic static pages.

3. Additional programming may be needed to customize Drupal modules to do exactly what you want. Alternatively, you may have to compromise on desired functionality, based on what is actually available.

PUBLISHING

Chapter 1

Benefits of building with Drupal

Disadvantages of Drupal

Introducing Good Eatin'

4. Hackers may try to target Drupal sites as there are a large number of sites that use Drupal.

5. There may be limitations to the framework, which could make building custom functionality more difficult.

Deciding on Drupal

As you may have guessed from the title of the book, we are picking Drupal for the Good Eatin' site. Drupal gives us the best combination of functionality, flexibility, security, and ease of use for our web site. In fact, Drupal is an appropriate choice for a range of web sites from small sites to large sites and everything in between. The chances are, if you are planning to build a site, that Drupal will fulfill all of your needs.

Extending the Good Eatin' site to other businesses

Although this book will concentrate on using Drupal to build a web site for a restaurant, most of the techniques discussed can be used to build sites for other types of businesses as well.

In Chapter 2, we discuss common functionality that is applicable to nearly all web sites.

In Chapter 3, we build a restaurant menu using techniques that could also be used to create a product catalog for other businesses.

In Chapter 4, we discuss interacting with customers by using polls, surveys, comments, and more. All of these would be useful to a great majority of businesses.

In Chapter 5, we build a company blog. For some companies, a blog is their only online presence. For others, a company blog is essential for keeping their customers up-to-date on current events.

In Chapter 6, we create a newsletter, as well as a calendar of events. Newsletters are a fantastic way of reminding customers about your products and services, and a calendar can help you to publicize special events relating to your business.

In Chapter 7, we integrate content from third-party web sites such as YouTube and Flickr.

In Chapter 8, we offer free content to those customer giving them an additional reason to come to your web site and continue visiting it.

_Chapter 1

In Chapter 9, we discuss online ordering and payments. E-commerce is used by many online sites to provide a revenue stream.

Getting started with Drupal

In this book, we will jump straight into using Drupal to build a practical web site, and not spend a lot of time talking about basic functionality, the design of Drupal, or theoretical aspects related to Drupal. We will use Drupal 6 the most recent active version of Drupal throughout this book. Drupal 7 is currently in development, while Drupal 5 is also available for use on sites.

If you have not installed Drupal yet, you can use the following steps to install it:

1. Navigate to http://drupal.org in your web browser. You can either download Drupal from the home page, or you can navigate to

http://drupal.org/project/Drupal+project and download it from there.

2. After you download the Drupal installation, you will need to unpack it. The installation is delivered in tar.gz format, for which you may need a specialized tool to unpack such as 7-Zip. 7-Zip is a freely-available program designed to work with a wide variety of compressed file formats.

3. After you unpack the installation, upload it to your web host. If you have not selected a host yet, skip ahead to Chapter 11, where we talk about recommendations for site hosting.

4. You can now browse to the location where you have installed Drupal in a web browser, to begin the installation process. You should see a screen similar to the following:

Drupal

Choose language

► Choose language

° Install Drupal in English Venfy requirements 0 Learn how tQ insta]] Drupai in other [anBuag6s

Choose language

► Choose language

° Install Drupal in English Venfy requirements 0 Learn how tQ insta]] Drupai in other [anBuag6s

Set up database

Install site

Configure site

Finished

Introducing Good Eatin'_

5. Click on the Install Drupal in English link to proceed with the installation.

6. Drupal will now validate that all requirements for Drupal have been met. If any errors are displayed, they will need to be corrected before proceeding. On a default installation, you will need to create a settings.php file based on the default.settings.php file, which can be modified during the install process, as shown in the following screenshot:

Requirements problem

The following error must be resolved before you can continue the installation process:

The Drupal installer requires that you create a settings file as part of the installation process.

1. Copy the ./sites/defeult/default.settings.php file to ./sites/default /settings.php.

2. Change file permissions so that it is writable by the web server. If you are unsure how to grant file permissions, please consult the on-line handbook.

More details about installing Drupal are available in INSTALL.txt.

Please check the error messages and try again.

After you fix any errors that are reported, you can click try again, and repeat this step until no errors are reported.

7. You will now need to create a database for your site. The exact method of creating a MySQL database will depend on the host that you have chosen for your site. If you are unsure of how to create a database on your host, contact your provider for additional help.

_Chapter 1

8. After your database has been created, you will need to enter the name of the database, as well as the username and password for the database.

Database configuration

Basic options

To set up /our Drupal database, enter the following information.

Database type: *

© mysqli O pgsql

The type of database your Drupal data will be stored in.

Database name:

yoursite_db

The name of the database your Crupal data will be stored in. It must exist on your server before Crupal can be installed.

Database username: *

youruser

Database password:

These will either be provided for you when your database was created by your hosting company, or you would have specified them yourself if you built the database from scratch.

Introducing Good Eatin'_

9. After you have entered the database information, click Save and continue with the installation. Drupal will automatically build all of the necessary tables for you, and update the configuration for your site. You will now need to enter some basic information for your site. First, enter the name of the site and a contact email address that will be used to send emails from the site.

Configure site

All necessary changes to ./sites/default and ,/sites/default/settings.php have been made. They have been set to read-only for security.

To configure your website, please provide the following information. Site information

Site name:

Your Site Name

Site e-mail address:

|[email protected] ite.com

The From address in automated e-mails sent during registration and new password requests, and other notifications, (Use an address ending in /our site's domain to help prevent this e-mail being flagged as spam.)

10. Next, you will need to add an administrator account. This account will be used for site administration, and has abilities which the other accounts will not. You should try to make the password for this account as difficult to guess as possible, to reduce the possibility of having your site compromised by malicious users.

Chapter 1

Administrator account

The administrator account has complete access to the site; it will automatically be granted all permissions and can perform an1/ administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.

Username: *

YourSiteAdmin

Spaces are allowed: punctuation is not allowed except for periods, hyphens, and underscores.

E-mail address: *

[email protected]

All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain nev£ or notifications by e-mail.

Password: *

Confirm password: *

mhww*_ Passwords match; Yes

The password does not include enough variation to be secure. Tryi '■' Adding both upper and lowercase letters. '-■ Adding numbers. '-■ Adding punctuation.

If you enter a password that is not very difficult to guess, Drupal will warn you and provide suggestions for a more robust password.

Introducing Good Eatin'_

11. Finally, you will need to define some basic server configuration options. In most cases, Drupal sets these items correctly for you, but you may need to review the time zone setting to ensure that this is correct.

Server settings Default time zone:

Saturday, October 25, 2008 - 10:52 -0600 t^j

By default, dates in this site will be displayed in the chosen time zone.

Clean URLs:

O Disabled ® Enabled

This option makes Erupal emit "dean" URLs [i-®- without in the URL]. Your server has been successfully tested to support this feature.

Update notifications:

0 Check for updates automatically

With this option enabled, Drupal will notify you when new releases are available. This will significantly enhance your site's security and is highly recommended. This requires your site to periodically send anonymous information on its installed components to drupal.org For more information please see the update notification information.

12. When you are satisfied with all of the information, click Save to complete the installation process.

13. Once the installation is complete, you can return to the main page, where you can login and begin the additional configuration of your web site. We will start building the Good Eatin' site from this stage, starting from Chapter 2.

If you want a more thorough introduction to Drupal, with explanations of some of the more theoretical aspects of Drupal, check out Building Powerful and Robust Websites with Drupal 6 by David Mercer, also published by Packt Publishing.

PUBLISHING

Jumping straight to dessert—Good Eatin' on the web

If you want to see an example of the techniques used in this book, as well as a live example of the complete web site, you can visit goodeatin.drupalbyexample. com. This site contains all of the examples developed throughout the course of this book. If you have questions about how to use Drupal, please post them on drupalbyexample.com, and I will try to answer your questions as quickly as possible. Alternatively, you can visit the Drupal forums at drupal.org/forum, to see if you can find an answer to your question; if not, you can post the question to the community.

In this chapter, we developed the requirements for Chef Wanyama's Good Eatin' website. We also looked at some of the possible methods of building the web site, before deciding that Drupal is perfectly suited to this web site.

Now that we have our requirements for the web site and have decided to build it using Drupal, it's time to get our hands dirty and begin building the web site. We will start with the basic functionality that 99% of the web sites need and then gradually move on to more complex tasks. We will use a step-by-step approach to building the site, so that you can follow along with the examples.

PUBLISHING

Chapter 1

Summary

Was this article helpful?

0 0

Post a comment