Drupals File Structure
The whole functioning of Drupal depends on this combination of . htaccess and index. php. For it to function properly, the files must be in the right place. If you start to move them to improve on the file structure, you will break this robust structure. The file structure does allow for several types of optimization within this structure, and you should consider them before you start your installation. Figure 2.9 shows the basic structure of a Drupal folder. You can see the index. php file ....
Using Relative Path Names
Within your Drupal folder, the names of files and subfolders are the same whether you are running in localhost on your own computer or in a path to an IP address or a domain name which in turn may be a subdomain or a folder within the domain . Rather than repeating this throughout the book, files and folders within your Drupal director are identified by relative path names that begin with a dot. Any relative path name that is not otherwise identified is relative to your Drupal folder wherever...
Getting Started with Panel Pages
The starting place, as always, is downloading, installing, and enabling the Panels modules along with the Chaos Tool Suite. There are three modules in Panels their settings are shown in Table 20.1. Download from Enable in section Permissions Panels Mini-Module Panels Module Panels Node Module Administration Administer, Site Building, Panels admin build panels Administer, use, and view use panels dashboard Administer, create, and edit The Chaos Tool Suite module also needs to be downloaded, as...
Using the Contact Form
Contact forms are created with the Contact module that is part of Drupal core. Enable it and set permissions, as shown in Table 13.1. The Contact module is used both for personal contact forms that is, contacting a user and for sitewide contacts to sections of the site. Core optional Drupal 6 Core Drupal 7 Administer, Site Building, Contact Form D6 admin build contact D7 admin structure contact Administer, Site Building, Contact Form D6 admin build contact add D7 admin structure contact add...
Enabling Credit Cards and Test Gateway
If you want to test with credit cards, enable Credit Card and Test Gateway in Uber-cart-Payment. When you have enabled Credit Card and Test Gateway, you will see that you can add credit cards as a payment method you will need to select the Test Gateway as the Default Gateway for their processing. When you start to actually use the site, you will use one of the other gateways to provide credit card authorization and charging. All you will need to do is to enable the appropriate gateway in your...
Using Access Rules
Access rules can be managed at Administer, User Management, Access Rules admin user rules , as shown in Figure 8.5. This is a powerful screening mechanism that is all the more powerful because, after it is set up, you do not have to worry about it again. The example shown in Figure 8.5 will deny access to anyone who attempts to register with an email address from ickydomain.com. There are many examples of internal websites where you want to reverse the process and allow access only from a...
Using Categories and Product Classes
Categories and classes are related but different concepts in Ubercart. Categories are simple taxonomy entries. Ubercart automatically creates a Catalog vocabulary when you install it. You can add terms to that vocabulary just as you would to any other taxonomy vocabulary go to admin content taxonomy list and click Add Terms for the Catalog vocabulary . Because this is a simple taxonomy vocabulary, all the rules apply. In particular, you can create hierarchies of entries. For example, you can...
Adding Images to Rich Text Nodes
In Hour 7, Using Content Construction Kit CCK and Images, you saw how to add CCK image fields to nodes. You also learned how to automate the process of creating thumbnails and specify which versions of images should be displayed in specific environments, such as RSS feeds. That addresses a host of issues related to images, but it does not solve one of the most basic how to include an image in the body text of a node. In all fairness, that is not one of the objectives. In some contexts, the...
Web User Identities
Another major feature of the modern web is the use of real and verifiable identities. With the rise of social networking sites, such as Facebook and Linkedln, more people are becoming used to an Internet in which online personas are real people. This has dramatically changed the web from a place of shadows and suspicion to something more like the real world with about the same degree of shadow and suspicion found in the real world. Drupal supports automatic verification of email addresses for...
Specifying a URL for Content
After the Path module is enabled, whenever you are creating or editing content, there will be a field to enter URL path settings, as shown in Figure 6.1. If it is not there, the Path module has not been enabled. The path is the relative path. Without a URL path that you specify, Drupal will construct a URL, such as yoursite . com q node 1. For such a site, you could create an alternate URL path to use, such as welcome. You would enter welcome in the URL path field, and the user would be able to...
Setting Up Ubercart Basics Catalogs Product Classes Products and Attributes
In Figure 16.1, you can see the basics of the Ubercart product structure. In fact, these are the basics of most e-commerce sites. A catalog lists categories of products. In Figure 16.1, those categories are Events, Membership, and Shop. Next to each category name, a number in parentheses indicates the number of products in that category. This number is never zero if there are no products in a category, the category is not listed. If you click a category, you can see its products. You then can...
Identifying the Security Components
Drupal implements a number of security components you may not use all of them, but they are there if you want them. When you first start to think about your Drupal site whether it is a new site or a conversion from another environment , security should be one of the first things you consider. The amount of time it takes to lay out your security strategy at the beginning is much less than the time it takes to devise it later on. And the worst case is implementing security after the site is up...
Creating and Sending Newsletters and Newsletter Issues
Now that you have set up Simplenews, you will want to create content newsletters and newsletter issues. To create a newsletter, select use Administer, Content Management, Newsletters, Newsletters to open the page shown in Figure 12.17. In addition to the basic information, specify how plain-text newsletters handle hyperlinks, as shown in Figure 12.18. You can create different newsletters or subjects to categorize your news e.g. Cats news. Dogs news, . A periodic newsletter of what's new from...
Test Your Webform
Whenever you are creating a form, try it out on people as you develop it. You can always switch back and forth between these two tasks, but the basic creation task has to come first 1. Create a new webform using the Create Content command in the menu. This opens the page shown in Figure 13.15. As with all nodes, you must provide a title Remember that the webform itself is a node the submissions from end users are linked to the node. Although you do not have to provide the description and the...
URL Conventions
Drupal users and the documentation are inconsistent on terminology in this area, so here is how this book handles these fragments of URLs. First, in this hour, we assume that you have installed and enabled Pathauto as described previously in Hour 6, Managing URLs Cleaning, Redirects, and PathAuto, p. 87. As a reminder, addresses on your website are provided as partial URLs. Thus, the first partial URL shown in the previous section actually resolves to yourwebsite.com myview personnel. Drupal...
Setting Up Subscriptions
The simplest way to manage subscriptions is to use the Simplenews block that is installed with the module. Along with other blocks, it is discussed in Hour 19, Using Blocks. If you use this block to let people sign up and unsubscribe, most of the work is done for you by the subscribers . Just set up the management structure and Dru-pal takes care of most of the work for you. Begin with Administration, Site Configuration, Simplenews Subscription as shown in Figure 12.14. The most important...
Setting Up Taxonomy
Using the Taxonomy module, you can allow users to categorize their data. Taxonomy is powerful and required by a number of other modules, such as Ubercart, discussed in Hour 16, Building an E-Commerce Solution. Enable Taxonomy as described in Table 9.3. TABLE 9.3 Taxonomy Module Reference Download from Core Taxonomy Module Administer taxonomy Administer, Content Management, Taxonomy D6 administer content taxonomy D7 administer structure taxonomy Taxonomy lets you build vocabularies, which...
Using Tokens and Customized Actions
The number of customized actions that you can create is unlimited. If you have the Token module installed, you can insert a variety of tokens into the actions. For example, you can trigger an email message to certain recipients when a trigger fires. The action you customize contains the email addresses you can use tokens to automatically compose the message, as shown in Figure 22.7. id system nwti, so s dm IT It Is de id system nwti, so s dm IT It Is de Table 22.2 shows the tokens available for...
Replace a Background Image
After you locate a theme with a background image of the right size and shape, you can download and install it and then replace the image. Explore the theme sufficiently it may have several versions of the image. For example, there may be a large version on the front page and smaller versions on interior pages. 1. Locate the background image or images that ship with the theme. Many themes use an images folder, and some have a subfolder for background images. In the case of the Acquia Slate theme...
Setting Up Simplenews
As always, the first step is to download, install, enable, and configure the Simplenews module, as shown in Table 12.3. TABLE 12.3 Simplenews Module Reference Download from Enable in section Permissions Simplenews Module Simplenews Module Simplenews Module Simplenews Module Administration Administer, Site Configuration, Simplenews admin settings simplenews Subscribe to newsletters for recipients Send newsletter for authors Administer Simplenews settings and subscriptions Administer newsletters...
Setting Up Profile CSV
As you will see in HOUR 12, USING BLOGSAND NEWSLETTERS, p. 197, you have various ways to communicate with your users. You configure Profile CSV using Administer, Site Configuration, Profile CSV admin settings profile_csv , as shown in Figure 8.18. You do not select which records to export here. Everything will be exported you will need to select the records to upload by selecting on the export opt-out field. If you are using the logic shown here, remember that opt-out will have a value of 1, so...
Selecting a Drupal Version
This is the easiest part Select from the current or the prior version after having checked the release schedule. Also, if you know the modules you want to use, check to see if they are available for the Drupal version you select. The numbering convention for Drupal has two numbers a major version and a release. Drupal 6.13 is thus the thirteenth release of Drupal 6. The number might be followed by -dev to indicate that it is in development. In the listings on drupal.org project drupal, you will...
Drupals Bootstraps and Bottlenecks
The .htaccess file is located at the root level of the Drupal file structure. It is a simple set of Apache settings, the key one of which is that all requests coming into the directory in which Drupal is located are redirected to the index. php file in that directory. By the time they get to index. php, they have been reformatted, but all that is done behind the scenes by Drupal, so you do not have to worry about it. The request is then routed into bootstrap. inc, a file in the includes folder...
Looking at a Panel Page
There are at least three meanings for the word page in Drupal Everything that you see on a website is presented as an HTML page. One of the two default content types for a Drupal site is a page. This is a basic Drupal node into which you can type or paste text, including filtered or full HTML. Thus, you can copy the HTML source code for an existing web page on your current site into a Drupal page content type. Remember to use the Full HTML filter. With the Panels and Chaos Tool Suite installed,...
Configuring Modules
As you have seen, Drupal consists of numerous PHP files that implement its functionality. These consist of its core functionality and optional functionality that you can enable using the module administration page, shown in Figure 4.28. You will see dependencies among modules that will often explain why you cannot enable a module. Also, if a module is required by another enabled module, you cannot disable the module that is in use by the other enabled module. Note the important links at in the...
Permissions Using Pathauto
After Pathauto is installed and enabled, you see two new buttons on the URL aliases administration page Delete Aliases and Automated Alias Settings. The second button lets you control how Pathauto works. If you are configuring Pathauto from the start of your website development, start here so that all the automatically generated paths are consistent. If you already have aliases created for some or all of your content, you may want to delete them. It is easiest to look at what you can do with...
Redirecting URLs
You can set Drupal to redirect from one URL to another using the Path Redirect module. Install, enable, and set permissions for it, as shown in Table 6.4. TABLE 6.4 Path Redirect Module Reference Download Path Redirect Module Administer redirects Administration, Site Building, URL List, Add-Redirect, Settings, Export Redirects admin build path-redirect By now, the basic administration tools should be familiar. The first button is a list of the URL redirects that you have created. As you can see...
Poormanscron and Newsletters
One of the tasks that cron.php performs is sending email newsletters if you have enabled them. There are reports that Poormanscron can send duplicate messages, so this is one case in which a true cron job is needed. The default settings shown in Figure 9.1 are a good place to start. As you build your website, you may want to periodically revisit these settings The cron demands during development are likely to be very different from those during production. My account Profile Export CSV Create...
Exporting Profile Data with Profile CSV
There is a small contributed module called Profile CSV that provides the link between Drupal and a bulk mail system, such as Constant Contact or Vertical Response. It produces a comma-separated-value CSV file that you can upload to your bulk email account. You must review the terms of your bulk email account so that the text in your user account registration form and emails reflects any disclosure you must make. The email opt-out button is one type of implementation, but it is not correct for...
Try It Yourself Creating the Database
On a shared server, you may run a script from the hosting provider to create a database in many cases, phpMyAdmin is provided for your use. If you have the ability to create your own database on a host or on your own computer , use MySQL Query Browser to create the database. It is available for free download at MySQL GUI Tools Versions for Windows, Mac, and Linux are available. This package also includes MySQL Query Browser. 1. Log in to your MySQL on your database host, as shown in Figure 3.1....
Posting from ScribeFire
After you set up the configuration, posting to your Drupal blog is simple 1. If the ScribeFire window is not open, choose ScribeFire from the Firefox Tools menu. If you are using a smart phone, touch the Blog or New Blog button in your blogging app. 2. Type your blog entry, as shown in Figure 12.8. Getting Started With ScribeFire - Scribefire Fire up your A lt A gt IP Title Porting from ScribeFire Flretac lt ScribeFire Default Font t , t 1 B I U S- J T T. H Ql ctarco - r.b b O 3. You may be...
Understanding Authenticated User Permissions
The role to which a user is assigned is based on that user's login information. This means that any user who is assigned to a role, with the exception of the anonymous not logged in role, is an authenticated user. In the example shown in Figure 8.2, every webmaster and every trusted user must, therefore, also be an authenticated user. This is reflected more clearly in the Drupal 7 interface where checkboxes that are irrelevant are disabled. If any of a user's roles grant a permission, the user...
Table of Contents
HOUR 1 Using Drupal and the Twenty-First Century Web 5 What Content Management Means and How It Helps You 8 Organizing the Drupal Project 11 Wandering the Worlds of Drupal 17 There Is No Drupal Look 19 HOUR 3 Setting Up and Installing Drupal 29 Planning for the Next Installation 29 HOUR 4 Administering Drupal, Themes, and Modules 47 Interacting with Two Interfaces 48 Getting Started with Administration 49 Exploring the Basic Submenus 52 HOUR 6 Managing URLs Cleaning, Redirects, and Pathauto 87...
Introducing the Date and Calendar Modules Calendar and Upcoming Events
For most people, the fact that the Date module implements a CCK date type is not terribly important. What they want is a calendar or a list of upcoming events. They want functionality that is built on top of the Date and Calendar modules. In this section, you will see what it can do out of the box. Within the Calendar module are two different calendars you can use An event-based calendar displays events. These are a content type that you can create with a wizard that is built in to the Date...
Exporting Cloning and Importing Views
Views are incredibly powerful they can easily become your major interface development tool if you want. They support methods for reusing your work. You can clone a view doing so creates a copy with _clone at the end of the name . You can then work in the clone to experiment with new features or to change it into a slightly different view. The Export command exports the code for a view. You can then use the Import command to open a window into which you can paste the exported code. In a single...
Creating Roles
Drupal has two built-in roles. You cannot delete them, but, as with all roles, if you do not grant permissions to them, they will not be able to do much of anything. Drupal implements a mechanism for letting users log in these roles are related to that mechanism. Anonymous Users who visit your website and do not log in. They are anonymous because you do not know who they are if they have not logged in. You can change the term for anonymous users in Admin, Site Configuration, Site Information D6...
Creating Newsletters with Simplenews
Do not let the word newsletter mislead you A newsletter, in the Simplenews sense, is an email message sent to a list of people the subscribers . A newsletter can be a one-sentence message reminding people of an upcoming event. It can also be a pages-long message with various topics covered. Also, if you add the MimeMail contributed module, a Simplenews newsletter can include styled text and images. People can subscribe to RSS feeds for blogs and other pages on Drupal, but newsletters represent...
Creating a New Category for a Sitewide Contact Form
The sitewide contact form is available after the Contact module is enabled. For end users to be able to access it, you must add one or more categories to it 1. Go to Administer, Site Building, Contact Form as shown in Figure 13.7 D6 admin build contact D7 admin structure contact . llils pape lets yuu set up you' site-wide contact form. TO do so, odd or riformation shown above tie contact form. TtviS can be useful Co provide Is a menu item dBabted by default to' a setting page, you can turtsmUti...
Content Management
The Content Management section of administration has all the settings you need to manage content. Notice that the actual creation of content is not an administrative task the Create Content menu is just above Administer at the left of Figure 4.3, and in Drupal 7, the Add button performs the same task. Although it is not a hard-and-fast rule, for many sites, content creation is a more widely allowed function than the administration of content Drupal separates content creation from content...
Using Images
Now that you have set up input formats to allow lt img gt tags, WYSIWYG, your editor of choice, and an image module such as IMCE, you are ready to use them. Create a new node using Create Content. You should see a toolbar above the body text area. You can experiment to see the interplay between the Image and IMCE check boxes. If you enable Image but not IMCE, clicking the image button in the toolbar lets you specify a URL for the image, as shown in Figure 11.23. Image description Alignment I --...
Quiz Answers Igg
1. You configure WYSIWYG to use a specific editor for a given input format, such as Filtered HTML. You can create additional input formats so that people can use different editors. This is commonly the case when you have several people devoting a lot of time to text data entry and each of them has different and strong preferences. 2. Image gives you a pop-up dialog in which you can provide the URL for the lt img gt element. With IMCE enabled, you can upload a file and browse the server to find...
Check Permissions as Your First Troubleshooting Strategy
If you add a new module to Drupal and it does not work, check permissions right away. It may need to be enabled on the Modules list and for permissions to be granted on the Permissions page. For each node type, three basic sets of permissions refer to the actions involved Each one is further specified by ownership of the node As you can see in Figure 8.3, the permissions are grouped by actions in Drupal 6, so when you add a new node type directly or as part of a module , you may have to jump...
Using the Date Wizard
After you install the Date and Calendar modules, the next step for most people is to go to Administer, Content Management, Date Tools admin content date tools to use the wizard, as shown in Figure 15.10. This creates a new content type and a calendar to which it is linked. Modules From the book Create content Administer Date Tools Date wizard Import Tools for creating and importing dates and calendars. After you click to start the date wizard, the wizard walks you through the process of...
Build a Webform for Help and Requests with Multiple Addressees
These forms are stored as submissions, but you usually also want to use the option to deliver them via email. If you have multiple addressees depending on an option, you can have the Webform module manage them. As always, the actual email addresses will not be visible to the end user. 1. Create a select component that lets users choose the subject of the webform this determines the addressee. Make sure that the select component does not allow multiple selections. It should appear as an option...
Focus on Collaboration Who
With its built-in workflow management and versioning tools, Drupal is ready for collaborative websites. Many Drupal sites are built by a single person, but many others are team efforts. Even when a single person develops a Drupal website, that person usually plays a variety of roles, such as writing and collecting content, planning the site, uploading files, monitoring the logs, and wishing that there were someone else to help out from time to time. Because Drupal is ready for collaboration,...
Ubercart and Drupal
Ubercart 2 is the current version of this complex set of modules as of the time of this writing. It is targeted for Drupal 6. For that reason, no Drupal 7 links are provided in this hour. See ubercart.org and the author's website for additional information as it becomes available. Table 16.1 shows the modules you should enable to work through this chapter. TABLE 16.1 Ubercart Module Reference Enable Ubercart-extra Enable Ubercart-fulfillment Flatrate, U.S. Postal Service, Weight Quote. If you...
Set Up ScribeFire or a Smartphone App to Post to Your Drupal Site
Follow these steps to configure ScribeFire, a smart phone app, or a desktop blogging application 1. Install and configure the Blog API as described in the previous section. 2. Install ScribeFire or another blogging app on your computer, as a browser plug-in or on your smart phone. 3. Launch Firefox and choose ScribeFire from the Tools menu. 4. Click Add in the lower right of the window to create a new blog account, as shown in Figure 12.3. It may open for you automatically the first time you...
Dirty URLs
The format of a URL can incorporate a query string, in which dynamic information could be transmitted. The query string follows the address of the document it is introduced by a question mark and continues to the end of the URL. The query string consists of one or more name value pairs of the form Name value pairs are separated either by ampersands or semicolons, so that you could construct a URL with a query string as follows Inside the query string, some special coding may be required because...
Managing Webform Results
If webforms are automatically emailed to recipients, there may be no need for further analysis. However, the Webform module provides significant tools for such work. You will find your webforms under Administer, Content Management, Webforms. When you go to a webform from Content Management or by going to the form with permission to edit it, you will find links to Submissions, Analysis, Table, and Download, as shown in Figure 13.25. Review submissions for a single webform. Let us know what you...
Anatomy of a Database Query
If you are familiar with relational databases and their access language SQL , you are used to the structure of queries, and you can map the view editor to an SQL query. If you are not familiar with SQL, do not think that you need to study up on SQL syntax, and you can skip this sidebar. The basic form of an SQL query is SELECT data FROM table WHERE condition ORDER BY sort-data Capitalization can vary by SQL implementation. However, in Drupal the db abstraction commands that insulate Drupal...








