Nicemenus
Drupal's out-of-the-box menu features provide an easy to use mechanism for creating horizontal and vertical menus, where those menus are restricted to a single level. In many cases you'll want to have the ability to create menus that have drop-downs for horizontal menus or fly-outs for vertical menus . Drupal's menuing system provides the ability to assign menu items in a hierarchical fashion however, it is up to us, the Drupal developer, to format menus so that items drop down or fly out when...
Installing Drupal
Now, we have arrived at the fun stuff. I am going to install Drupal on my local server first and at the end, I'll duplicate the installation to my web server section 9.11 . Let's get started 2. Upload the Drupal files to your web server, look for the hidden files as well Be sure to use the binary upload mode in your ftp program2. 2The FTP programs I prefer are gFTP and Konqueror for Linux, and Firefox's FireFtp Add-on cross-platform . 3. Check that all file permissions are set to 755 chmod 755...
Setting Up Cron Jobs
In Drupal, cron jobs are used to schedule and perform various maintenance tasks on your site. Within a Drupal site, cron jobs trigger several important tasks, such as building the search index for your site, and generating and updating log files. Frequently, other modules will also set up actions that are triggered by cron jobs. The name cron job comes from the Linux utility cron, an automated scheduling program installed on Linux systems. For an overview of cron, visit http en.wikipedia.org...
Contact Page 1
Content can be created similar to the homepage, although when it comes to the menu, we want the link to be the first one in the menu. To do this we select the Parent item as Navigation, and then give the item a light weighting. I've selected -10 as the Weight, in case we decide to add a lot more menu items later. The menu setting for the contact page is as shown The name to display for this menu link. The description displayed when hovering over a msnu Item, Optional- In the menu, the heavier...
Adding content
5. Optional Add a taxonomy category for Artist to the Audio content type, at admin content taxonomy add vocabulary. MP3 tags also known as ID3 tags offer a single field for Artist. If we choose to add a taxonomy field for Artist, we will actually be required to enter the artist name more than once, but it's an easy way to make sure that multiple artists can have their own page on the site. It would be hard, for instance, to offer a separate page for songs by Naomi Bernstein with the MP3 Artist...
Including Fields from the Profile Node on the Registration Form
If you would like to include any of the fields from the node-based profile on the user registration form, you will need to enable the Content Profile User Registration module. As mentioned earlier in this chapter, this module ships with the Content Profile module like all modules, it can be enabled at Administer Site building Once the module has been enabled, we will need to access the base Content Profile settings by clicking on the Administer Site building Content types link, or by navigating...
Forums 1
Installing Drupal on Ubuntu Fr gt , 04 02 2010 19 42 - testuser Are there specific configuration options that I should be aware oF if I'm going to install Drupal on Ubuntu Figure 9-12. A Forum Topic with a comment Drupal core's forum module has a rather limited feature set. A contributed module called advanced forum provides a number of enhanced features, such as mark all topics in a single forum or all forums as read, forum statistics including number of topics, posts, users, latest user, and...
Web Forms
Collecting information from site visitors through online forms is another key interactive feature that is easy to enable and use on your new site. Using the Webform contributed module, you can create simple forms such as a form that is used to submit a question or complex questionnaires using the features enabled through the Webform module. To demonstrate how easy it is, I will walk you through the process of creating an online suggestion box where site visitors can enter and submit suggestions...
Setting Up Products
With the general storefront parameters set, I'm ready to set up the products on my site. For my site I am going to sell Drupal 7 coffee mugs and t-shirts. The first step in setting up products is to define the product categories that you intend to use on your site. Ubercart uses Drupal's taxonomy system to categorize products, and automatically creates a vocabulary named Catalog. Following the steps outlined in Chapter 4, I'll add the new terms for coffee cups and t-shirts. When creating the...
Ubercart Overview
Ubercart is a full feature web storefront offering key features that make it easy to list and sell physical goods, virtual goods, subscriptions, and event registrations. Ubercart provides a simple-to-use interface for creating product categories, product catalogs, and product listings. Ubercart manages the inventory of the items you are selling, the orders that customers place on your site, the payments customers make, and the shipment process when physical items are shipped from your...
What Is a Theme Engine
A theme engine is a collection of scripts and files that serve to interpret the programming language used and process the commands contained therein. As data is drawn from the database and from outside sources if any , the theme engine plugs the data into a predetermined format for display. There are several popular theme engines, each of which is designed to interpret different templating languages. Drupal is distributed with the PHPTemplate engine. PHPTemplate is popular for a variety of...
Views 1
If you ask anyone who has used Drupal for a while what the killer module is, the answer will likely be Views, Panels, or the Content Construction Kit CCK . Views is usually mentioned first, and it's the module that many users say they can't live without. What does the Views module do that is so special Simply stated, Views provides an easy-to-use tool for selecting and displaying lists of content on your website. Examples of how you might use Views include Displaying the most recent news...
Installing Updates
All the permissions in the world won't help you if your board has a flaw in its security, which could let Joe Hacker simply slip past those permissions Fortunately, the phpBB Group regularly publishes updated versions of phpBB that contain security and other bug fixes. Keeping up with these updates, as tedious as it may be especially if Chapter 11 inspires you to install a ton of modifications , is quite important, as updates have been known to be released in rapid succession. While installing...
Two Contrasting Examples
As you can probably see, PHPTemplate presents a number of options that can be used to support the creation of themes. You can almost literally do as much or as little as you like. A look at the range of techniques used by the themes in the market shows a wide variety of approaches to theming. Some themes, like the Gagarin theme we installed in Chapter 2, take a very elemental approach and implement only the bare minimum. Other themes, like the default theme Garland, are more complex, and...
Command Line Backups of Core Codebase Contributed Modules and Files
Earlier in this chapter, we took a full backup of the codebase by downloading a copy of the codebase via FTP. In this section, we will cover how to make code and file backups via the command line. We will also break our backup into three separate sections 2. Contributed modules, contributed themes, and the settings.php file These distinctions will be useful later in the chapter when we go over how to upgrade your site.
How to Download Install and Configure a Module
The first step in installing a module is finding the right module to use. As described earlier, there are thousands of modules to pick from finding the right one is often the biggest challenge. For demonstration purposes, let's pick one of the most popular, powerful, and useful modules the Views module. A new feature of Drupal 7 is an administrator's page, which allows you to download and install a module by simply entering the URL of the install file and clicking a button. Drupal handles the...
Publishing 1
When we sell a book written on an Open Source project, we pay a royalty directly to that project. Therefore by purchasing Drapal Multimedia, Packt wiU have given some of the money received to the Drupa Project. In the long term, we see ourselves and you customers and readers of ouxbooks as part of the Open Source ecosystem, providing sustainable revenue for the projects we publish on. Our aim at Packt is to establish publish g royalties as an essential part ol the service and support a business...
Bayesian Filter
The Bayesian filter learns to detect spam by being shown content that has been identified as spam by the site administrator. The best way to describe this method is to quote Jeremy Andrews, the author of the Spam module. The Bayesian filter does statistical analysis on spam content, learning from spam and non-spam that it sees to determine the likelihood that new content is or is not spam. The filter starts out knowing nothing, and has to be trained every time it makes a mistake. This is done...
A Picture Says a Thousand Words
Further down the line we will add photographs to our product listings. Here are some advice and tips to consider when taking photographs, which will help take great pictures for your store. _ These tips were provided courtesy of award-winning photographer T Martin Baker who has a website dedicated to photography and image I engineering The camera and support equipment we use are very important. We don't particularly need an expensive camera, but the following features really A camera with a...
Phptal
PHPTAL is a PHP implementation of the ZPT system. ZPT stands for Zope Page Templates. ZPT is an HTML XML generation tool created for use in the Zope project http www.zope.org . ZPT employs TAL Tag Attribute Language to create dynamic templates. Visit the Zope site to learn more about the origins of the system, and how it all works. TAL is attractive for several reasons. TAL statements come from XML attributes in the TAL namespace that allow you to apply TAL to an XML or plain old HTML document...
Update Notifications
Check for updates automatically If checked, this feature looks for updates to Drupal core and any contributed modules you have installed and highlights cases where a new version or a security patch has been released. It's a good idea to check this, as it makes the task of tracking updates to modules much easier than having to manually check each module's status. Receive e-mail notifications If checked, this directs Drupal to send an e-mail to the administrator when new versions of modules are...
Converting XMLRPC using modules
The first Drupal versions to use the new library are 4.5.5, 4.6.3 and 4.7. If you have a custom written Drupal module for an older version, then the following applies. return array 'foaf.getUrl' gt array 'function' gt 'foaf_get_url' gt return array 'foaf.getUrl' gt 'foaf_get_url' gt Now let's see the handler function itself. It's parameters are regular PHP variables now, there is nothing to process. So now you can write things like function username, password instead of doing parameter...
Activity Creating the Bio Attachment display
As mentioned earlier, the main display of this view will be via an Attachment display. This display will show one bio, the ID of which was passed to the display as an argument in the URL that is selected from the list we created previously. 1. We'll first create an Attachment display. 2. Edit this display's name. There will be more than one Attachment, so something less generic will be of more help. 3. Change the Items to display setting to 1, since we'll be showing only one bio at a time,...
Creating a Panel Page
When creating a panel page, you need to decide what content is going to go on the page, as well as the layout for the page. You can use Figure 12-2 to figure out whether an off-the-shelf layout exists that meets your needs. If one of the eight basic layouts doesn't work, you can always create a custom layout using the flexible option. For demonstration purposes, we're going to assume that we want to divide the content region into three rows, with the first row having a single column, the second...
Other Useful Programs Mfa
Neither of the following programs is available in Ubuntu yet, but you can download them as source code from the www.kokkinizita.net linuxaudio web site along with a variety of other tools suitable for use in mixing and mastering Jconv GNU Linux A convolution engine for JACK. Reverberation is sampled from real spaces, such as cathedrals, using the impulse response technique. This naturalistic reverb can then be applied to a digital mix using convolution. Jkmeter GNU Linux An audio mastering...
Drupal JavaScript behaviors
As I mentioned at the beginning of the chapter, the drupal.js library is Drupal-specific. The main advantage of using a tightly-coupled library is that the tools provided are aware of the Drupal structure and do things the Drupal way. The Drupal Behaviors feature provides a standard method for attaching some particular information called a behavior to zero or more elements on a page. To understand this admittedly vague description, let's start with an example and build a better explanation. In...
Listing Your Module on the Administration Page
Drupal's administration page presents the various site configuration options to the site administrator. You want your module to have a place on this configuration page, so that the site administrator can adjust the settings for your module. Let's add some more configuration options to the node annotation module we built in the previous chapter. We need to provide a link on the administration page so that the site administrator can get to the screen where our settings can be changed. We put the...
Creating Tables
A global variable called db_type determines the database type currently in use. In the following example, a hook_install function includes different CREATE TABLE statements for MySQL and PostgreSQL. Here's an example from the book.install switch GLOBALS 'db_type' case 'mysql' Use same as mysqli. case 'mysqli' db_query CREATE TABLE book vid int unsigned NOT NULL default '0', nid int unsigned NOT NULL default '0', PRIMARY KEY vid , KEY nid nid , 40100 DEFAULT CHARACTER SET UTF8 break case 'pgsql'...
QQ Creating a Patch File
In this exercise, you create a patch file against the beginning_drupal module. NOTE In order to complete this exercise, you will need to have the diff and patch applications installed. Mac OS X and Linux include these utilities, but Windows does not. Windows users can download and install diffutils from Alternatively the Cygwin shell can be used http cygwin.org. Follow these steps to create the patch 1. Create a copy of beginning_drupal.module, and name the new file beginning_drupal.module....
Accessing the Drupal Site
To access the Drupal site, open your browser and navigate to the value that you set for the base_url. If you've done everything correctly, you'll see the screen shown in Figure 1-1. Welcome to your new Drupal-powered website. This message will guide you through your first steps with Drupalj and will disappear once you have posted your first piece of content. Welcome to your new Drupal-powered website. This message will guide you through your first steps with Drupalj and will disappear once you...
Downloading the Module
The e-Commerce module's website is located at http drupal.org project ecommerce and the download link for the module is near the bottom of the page. We want to download the file for 5.x-3.3 or a newer version if available. Official Official We also need another module, called the Token module. The e-Commerce module depends upon this module, so let's download that from its project page http drupal.org project token. We want the version for Drupal 5.x, which is version 1.8 or newer version 1.9...
Using the Flexible Layout Option
There may be situations where one of the eight pre-defined layouts available in the Panels module do not meet the layout needs of a particular page. In these situations, you can use the flexible layout option, which provides the ability to create virtually any layout you can imagine. To create a new flexible layout page, follow the steps outlined in the previous section for creating a new panel page click on the Structure link in the top menu, followed by Panels on the Structure link, and the...
Formatting the Output of a Custom Content Type
There will be times when the visual representation of your new content type doesn't fit with how you would like the content created with your new content type to be rendered on the screen. Adjusting the order and positioning of the labels in relation to the field can be accomplished by clicking on the Manage layout link for the desired content type. To access this feature, click on the Structure link at the top of the page and then click on the Content type link on the Structure page. To access...
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 ....
Throttling blocks
You can also throttle your blocks. To do this, go to the Blocks admin page here Administer Site building Blocks. You'll notice that there is a new checkbox selection for Throttle. You can choose which blocks to throttle by checking the Throttle checkbox next to each of your enabled blocks. We'll go ahead and throttle all of our blocks except for the User login, as we still want to allow users to login to the site during high traffic periods. The throttle functionality works the same here as it...
Input Formats and Filters
It is necessary to stipulate the type of content we will be posting, in any given post. This is done through the use of the Input format setting that is displayed when posting content to the site assuming the user in question has suf cient permissions to post different types of content. In order to control what is and is not allowed, head on over to the Input formats link under Site con guration. This will bring up a list of the currently defined input formats, like this JfiHir tonici dAn 1...
Authentication Hooks for Downloading
Module developers can implement hook_file_download to set access permissions surrounding the download of private files. The hook is used to determine the conditions on which a file will be sent to the browser, and returns additional headers for Drupal to append in response to the file HTTP request. Note that this hook will have no effect if your Drupal installation is using the public file download setting. Figure 13-4 shows an overview of the download process using the implementation of...
Organic groups access control
Organic groups Views integration this module requires the Views module, which we have already installed. Organic groups vocabularies this is provided by the OG Vocabulary module all other modules are part of the Organic groups module. Click the Save configuration button to save your settings. Upon enabling the Organic groups access control module, you will be prompted to rebuild the content access permissions, as seen in the following screenshot The content access permissions need to be...
Assigning a Taxonomy Vocabulary to a Content Type
Providing content authors with the ability to assign one of the terms to a new piece of content requires that a site administrator updates the all of the content types to include a reference to the vocabulary that we wish to link to content on our site. The first step is to identify all the content types that you want to associate with the new vocabulary. You may decide that all content types will use the vocabulary to categories the content created on your site, or you may decide the...
Activity Creating the Bio view
1. Start by creating a new view of type Node, and naming it bio. Node revision Term User Access log Next 2. Having created the view, we will see its panel. At this point, we haven't created a display, and are looking at the default settings. As a reminder, anything we set here will apply to each display in the view unless we override the setting. 3. We'll make a couple of settings changes here, because the settings will be used by more displays than not, and we won't have to edit these settings...
The Blog Post Content Type
The values of the Explanation or submission guidelines are somewhat arbitrary while this section can be used to give instructions, it can also be used to have fun. Obviously, the rules of civil and appropriate discourse apply, but you can use these instructions to add a touch of unexpected flavor. Click the Administer Content management Taxonomy, As shown in the following screenshot, click the edit vocabulary link for the Keywords taxonomy we created in Chapter 3. Then, add Blog post to the...
Create new categories
Our blog entries will need to be organized into categories in order to group them together with other blog entries, according to geographical location. Go to the Taxonomy link under Content management section in the Administer page, and navigate to the Taxonomy page. If you have started a new site, then you will see at the foot of this page a notice that there is no vocabulary available for your new categories. The vocabulary is a term by which a collection of categories or terms can be...
Parent Items and Weight
In the administration system, the terms parent item and weight often remain hidden, because Drupal uses a drag-and-drop interface to rearrange items. Nevertheless, there are some screens where you will need to understand their meanings. Both taxonomy and menus may rely on hierarchies for their organization. When items are organized within a hierarchical sorting system, Drupal uses the term parent item to define which taxonomy term or menu item is closer to the top of the family tree. When you...
Zooming and Measuring
After the Color Picker pipette icon, next in the GIMP's Toolbox are the Zoom tool, which has a magnifying glass icon, and the Measure tool, which looks like the kind of compass used on a drawing board. The Zoom tool is straightforward click to zoom in on an image, and Ctrl click to zoom out. To save yourself switching tools constantly, you can use the keyboard shortcuts of plus and minus - . The only problem with these default shortcuts is that on many keyboards, you have to hold down the Shift...
Adding Opening Titles
All good movies start with the title and credits for the major protagonists. The people who did the catering have to wait until the very end of the movie before they get to see their names, in a very small font, up on the screen. Choose Project gt Save As or Project gt New Project, and give your video a name. Unusually, with Open Movie Editor, you don't need to remember to save the project as you go along, because all edit decisions are written to the project file. Next, click the Filters amp...
Country settings
Selecting the Country settings link will lead to the expected Country settings page. Select the Import countries link to give Ubercart the details of the countries that your cart will deal with. In this case, and only for the purpose of illustration, we have selected United Kingdom Canada and the United States have been imported by default. Country settings overview Country formats Country file united_kingdom_826_l.cif imported. To import new country data, select it in the list and click the...
Installing the ImageField module
In order to successfully install the ImageField module, we will also need to install the modules that the ImageField module is dependent on. Because of this, we will first need to install a total of three modules in order to use the ImageField module. These modules are as follows FileField ImageField Once we place these three modules in our site's modules folder, we can navigate to Administer Modules, where we should see the following Defines a file field type, mt . Depends Oft Content enabled...
The Seq Configuration File
On startup, seq24 reads in preferences from the file .seq24rc a hidden file in your home directory . Close seq24 first, and you can then modify this human-readable file in a terminal with a text editor for example, using the nano editor By default, seq24 manages MIDI connections itself, indicated in the following stanza of the .seq24rc set to 1 if you want seq24 to create its own alsa ports and not connect to other clients 0 This 0 in the last line is a user-friendly setting, because as you've...
Backing Up the Codebase
In order to create a back up of the codebase, use your FTP client to connect to your server. Ideally, for reasons of download speed and stability, this should not be done over a wireless connection. When the download is complete, you will have a full copy of your working codebase saved on your computer. Later in this chapter, we will cover using the command line to speed up this process, but, for those of you who want to avoid the command line, you can make adequate backups of your codebase...
Setting Up Your First Forum
To enable the Forums module, click on the Modules link in the top menu and scroll down the page until you see the Forum module. Check the box associated with the module and click the Save configuration button at the bottom of the page. Drupal will install the Forums module. The next step in the process is to set permissions for forums. Here are the permissions that you can Create new forum topic content Edit own forum topic content Edit any forum topic content Delete own forum topic content...





















