an All Creative World site
Ivan's picture

Lesson 3: Understanding the Drupal file structure

It's important to understand the basics of how the directories and files are structured on your Drupal site.

When you install Drupal with the Acquia installer from Lesson 1 or using the files from Drupal.org you will have a default file structure either on your local machine or on your server. If Drupal is installed on your local machine you will find it here:
YourUser/acquia-drupal-site/acquia-drupal/...
This is the root of your website. Everything we discuss from here onward will be within this folder.

Within this folder you will find all the files required to run your site. You do not need to know what each files does necessarily, but four sections. These are needed to be able to install new modules or themes and upgrade your site. Let's take a look at them one by one.

Modules

Modules are pieces of code that provide different functionality for your site. There are three types of modules.

Core modules can be found in the modules folder within your site's root. These are the modules that provide basic functionality to your Drupal site and they come with your basic Drupal installation.

Contrib modules (user contributed modules) provide extra functionality to your Drupal site. You can choose from thousands of modules on Drupal.org. When you find the module you need you should download the version that matches your version of Drupal. Do not use a module that is still under development unless you're just playing with it. Once you downloaded the compressed file, uncompress it and place it in the following folder: sites/all/modules/.... By default this directory doesn't yet exist so you will have to create it. Your modules will look like this:
sites/all/modules/image
sites/all/modules/pathauto
sites/all/modules/views
...

Do not put contrib modules next to the core modules. Although they will work that way too it will make upgrades more difficult later.

Once you placed the contrib modules in this folder Drupal will automatically recognize them and you will be able to enable them under the menus Administer/Modules.

Custom modules are required if you can't find the functionality you need within core or contrib modules. In this case you can ask a programmer to write a new module that answers your brief and fits into the Drupal ecosystem of modules. You will place this custom module next to contrib modules.

Themes

Similarly to modules there are three different types of themes.

Core themes come with Drupal and they are located under the root in the themes directory.

Contrib themes are available from Drupal.org themes section. Put them into this folder: sites/all/themes. By default this directory doesn't exist so you will have to create it first. These new themes will be recognized by Drupal automatically as well. They can be enabled under the menus Administer/Themes.

Custom themes are themes created by you and should be placed next to contrib themes. In most cases you will create a custom theme, so this is an important subject that we will discuss in great detail in the upcoming lessons.

Files

When you or your users upload any files through the Drupal interface these files will be stored on your server. The files folder will be created automatically and it is located here sites/default/files. You don't need to do anything about these files, but it's important to know where they are located.

Settings

When you setup a Drupal site you will have a few settings that make your site functional. These settings are stored in a file here: sites/default/settings.php. When you install your site with Acquia or Drupal installer this file and the settings inside will be done automatically for you. It's important to keep this file safe because it includes the passwords for your Database database.

Congrats, you now know the basic file structure of Drupal.

Commenting on this Blog entry is closed.

monkey1979's picture
680 pencils

Brilliant stuff Ivan, cheers again.

living on dreams and custard creams.

Art D. Rector's picture
3165 pencils

Thanks Ivan.

Ivan's picture

Thanks for the encouragement guys.

qwertyale's picture
2048 pencils

I'm at this development stage =P and need to choose a good theme to work on and installing and uninstalling modules.

yesterday I installed a program called "Artisteer" http://www.artisteer.com/ that I'd seen on my friend's PC. I'll open tonight =] the mac version is still beta but I'm happy to find it

It's a theme customization software that will not satisfy us completely but I think program like this will be a standard for all of web page cofiguration tool.

I'm on stand by waiting for Ivan's 2 or 3 chapters from now about publishing =P

yes I'm brazilian xD

Ivan's picture

Looks really interesting.

Ivan's picture

I just played it and it's surprisingly powerful. Simplifies the theme building tremendously and makes it possible to create a theme without the need of any css or html. Needs aesthetic knowledge from a designer as the randomly generated themes are pretty bad.

monkey1979's picture
680 pencils

Artisteer is quite good on initial reactions, there are lots of options. For quick jobs it could be excellent. I managed to knock up a pretty decent theme in 1/2 an hour, that, with the features of the cms added, I know some of my customers would snap up.

It is very restricting, so I still need to learn how to make my own drupal themes, but it's very useful.

living on dreams and custard creams.

steveballmer's picture
651 pencils

All of this Mac commandline stuff is just too hard!

http://stevefakeballmer.wordpress.com
I am not Steve Ballmer pretending not to be me!

Ivan's picture

Where do you see command line? :)

steveballmer's picture
651 pencils

.... it's there!

http://stevefakeballmer.wordpress.com
I am not Steve Ballmer pretending not to be me!

MixiBoi's picture
61 pencils

Ah, Drupal, you're the Linux of blogs...

monkey1979's picture
680 pencils

Hey Ivan, Is this series dead now? Hope not I was enjoying it! :)

living on dreams and custard creams.

benetta's picture
1 pencil

It's true that the value of a theme can be much higher if you know what it's going to be used for.
For now I'm just building themes that are designed to use Drupals core modules but in the future I will surely deviate from that.
Ubercart should be in your list as well by the way!

Read more: drupal themes

Creativebits is a blog about Creativity, Graphic Design, Adobe, Apple and other related subjects.

Featured Images

Do you need a great new logo?

If you need a logo for your company or product you can get it done with us.
In our logo store you can pick from over 28,000 pre-made logos that will be customized to your name for free or you can post a contest for us for just $250 and our designers from all over the world will submit dozens of logo design suggestions to your specific needs.

Marketplace