- Drupal for Education and E/Learning
- Bill Fitzgerald
- 1141字
- 2021-05-28 17:43:18
Installing Modules and Themes
As you run and administer your Drupal site, you will need to install and enable different contributed modules and themes. To understand how to install contributed modules and themes, we will need to take a brief look at Drupal's directory structure as pictured in the following screenshot:

As seen in the preceding screenshot, the directory structure contains seven directories, in addition to 15 files in the base folder of the Drupal install.
Files
On looking at the files in the base folder of the Drupal install, we will see three different types of files: an .htaccess
file, a series of .txt
files, and a series of .php
files. The .htaccess
file contains specific settings that help ensure that your site runs smoothly; the .txt
files (with the exception of robots.txt
) all contain information about Drupal, and the .php
files are all part of the codebase that allows your site to run.
For most sites, you will never need to open or edit any of these files. Of all the files in the base directory of your Drupal install, the only two that could ever require editing are the .htaccess
file and the robots.txt
files. However, tweaks to these files should only be done when absolutely necessary and you should always back up these files before attempting any modifications to them.
Directories
On looking at the directories of the Drupal install, we will focus on three directories: modules, themes, and sites.
Core Modules and Themes
The modules and themes directories of the core Drupal install, indicated by the dashed arrows in the preceding screenshot, contain the core modules and themes.
The Sites Directory
The sites directory, indicated by the solid arrow in the preceding screenshot, contains the directories into which we install additional modules and themes. The default Drupal installation, as shown in the following screenshot, comes with two sub-folders in the sites directory: all and default.
The default directory contains our settings.php
file; the all directory is where we will put contributed themes and modules.
To start, we need to create themes and modules directories in sites/all
, as pictured in the following screenshot:

Once you have created these folders, you are ready to install modules and themes.
Adding Modules and Themes: The Steps
To add a module or a theme, follow these four steps:
- Download the theme or module from drupal.org.
- Decompress the theme or module. They are packaged on drupal.org as
tar.gz
files, and need to be extracted before they can be installed. - Upload the theme or module to your site.
- Enable the modules at
admin/build/modules
or the theme atadmin/build/themes
.
All modules and themes are downloaded from their project page. In this example, we will download and install the Views module and the Advanced Help module. To get the source code, we will navigate to the Views project page at http://drupal.org/project/views as shown in the following screenshot, and also the Advanced help project page at http://drupal.org/project/advanced_help.

The Views project page shows only the official releases; other project pages frequently show development snapshots. The Status column, indicated by Item 1 in the preceding screenshot, gives you information about the different versions that are available. In most cases, you should only use official releases that have a status of Recommended. Also, the version of the module needs to match up with the version of Drupal; for example, only the 6.x versions of modules work with Drupal 6.
In this case, we want to install Views for Drupal 6, so we click the Download link, indicated by Item 2 in the preceding screenshot, to download the module.
Then, repeat these steps for the Advanced help module at http://drupal.org/project/advanced_help.
Once you have downloaded the code from drupal.org to your computer, decompress the file. On a Mac or Linux machine, this will occur automatically; on a PC, use 7-zip (an open-source utility available at http://www.7-zip.org) to decompress the tarball into the Views directory.
Open your FTP client, and upload the directory containing the module (in our case, Views) to the sites/all/modules
directory as shown in the following screenshot:

Once the modules have been successfully uploaded into your sites/all/modules
directory, click the Administer | Site Building | Modules link, or navigate to admin/build/modules
as shown in the following screenshot:

This screen gives a breakdown of the modules that you have uploaded into your sites/all/modules
folder.
To enable the Advanced help module, select the checkbox next to Advanced help. To enable the Views module, select the checkboxes next to the Views, Views exporter, and Views UI modules. Click the Save configuration button to save your settings and enable your modules. You will receive a confirmation message at the top of the screen.
Tip
Many modules are actually a collection of related modules. For example, the Views module comes with three related modules. Before you install any module, you should read the README.txt
and the INSTALL.txt
files that come with most modules. These files are usually located in the base directory of the module download.
Configuring Modules and Themes
Now that we have finished installing modules and themes, we need to configure them.
Once you have enabled a new module, you should check to see if there are any configuration options for the module. To do this, navigate to the main administration page, either by clicking Administer, or by navigating to admin
. Then, click the By module tab as shown in the following screenshot:

By looking at the page, we see that both the Views module and the Advanced help module have links to Configure permissions. These permissions are covered in more detail later in this chapter, in the Creating Views section.
After you have uploaded a theme into the sites/all/themes
directory, you will need to enable it via the Administer | Site Building | Themes link, or by navigating to admin/build/themes
. Themes and their different settings are covered in more detail in Chapter14: Theming and User Interface Design.
Modules and Themes: A Summary
As described in this section, installing modules and themes involves four steps:
- Download
- Decompress
- Upload
- Enable
Modules are uploaded into sites/all/modules
, and themes are uploaded into sites/all/themes
.
Modules, once uploaded, are enabled at admin/build/modules
.
Themes, once uploaded, are enabled at admin/build/themes
.
Although different modules and themes will have varying configuration settings, the above steps will remain constant for any module or theme you use on your site.
- PS職場達人煉成記:人人都能學會的Photoshop辦公設計技巧
- 中文版Premiere影視編輯課堂實錄
- 中文版SolidWorks 2015技術大全
- AutoCAD Civil 3D 2018 場地設計實例教程
- 改變思維:菜鳥也能做出震撼PPT(全彩版)
- MATLAB 2015從入門到精通
- 照相館的故事:Photoshop CC 2018調色合成精修
- 通達信炒股軟件從入門到精通(第2版)
- BIRT 2.6 Data Analysis and Reporting
- Excel數據管理:不加班的秘密
- Photoshop CS6完美創意設計:不一樣的圖像藝術處理
- Vue 企業開發實戰
- Adobe創意大學InDesign CS5 產品專家認證標準教材
- 從零開始:Illustrator CC中文版基礎培訓教程
- CAXA 實體設計2013案例課堂