I have created a site at http://theming.isaacsonwebdevelopment.com that delivers a reasonably complete presentation on theming. It even includes a small custom module that illustrates how to create a themable function and a theme that overrides that function.
You may register on the site to view the presentation in your choice of four different themes: Garland, a garland sub-theme, an Andreas03 sub-theme, and a Fusion sub-theme. The Fusion sub-theme implements the theme function override.
Template files are what Drupal uses to determine how to render the HTML for a page. When you wish to create a custom theme, there are several files you will likely include in your theme's directory:
- page.tpl.php - this controls the overall look and feel of your site (slight change for Drupal 7). For those of you who have coded sites with HTML (and CSS), this is like the index.html page you created.
- node.tpl.php - this controls how a node is built
There is only one file you must create in order to define your first custom theme: the ".info" file. Create a new subdirectory somewhere under your "sites" directory. For instance, try creating the subdirectory sites/all/themes/mycustomtheme. Inside that subdirectory you can create mycustomtheme.info. Note that you do not have to use the same name for the .info file, but it is common practice just to keep things logical.
Okay, so you are ready to start customizing your Drupal installation. Before you get started, there are some things you should know and follow.
- Drupal provides a directory structure that is designed to be used in a certain way. Notice the subdirectories below your Drupal root:
When you first create your Drupal site, you are asked to supply a user name and password. This first user (User ID 1) is the "root" user. This user has complete control over the site. So, you will want to give this first user a special name like admin, webmaster, or some other such signifier. Don't worry if you have already created this user with another name; you can update this user's name at any point. Just sign in and use the "My account" link from the Navigation menu or go to the path user/1. In general, you don't want to create any content under this profile.
Isn't it nice how Drupal provides a set of instructions on how to get started building your website? And isn't it neat how that disappears as soon as you create a piece of content that is promoted to the front page? To find out how Drupal does this, take a look under the hood by checking out the code at modules/node/node.module in function node_page_default() at line 1775 (as of Drupal 6.19).
The query statement that specifies to look only for content promoted to the front page is at line 1760 and looks like:
Okay. You finally got the courage to do some upgrades and/or installations of modules on your site and, like a good webmaster, put your site into off-line mode. Then you signed out. Now when you visit your site you get the message that the site is currently off-line.
How are you supposed to get back into the site to put it back online? Actually, it's quite easy. Just point your browser to
That wasn't so bad, was it?
In my blog entry about the difference between the Page and Story content types I mentioned that one of the differences between the default Page and Story content types is that the Story content type is promoted to the front page. In this entry I will go into more detail about modifying your site's settings.
You get to the settings screen by navigating to admin/settings/site-information.
To get to the global theme settings page, navigate to admin/build/themes/settings/global. As stated at the top of the page
These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.
In a previous entry I wrote about a couple of default content types that Drupal creates and the difference between those two content types. In this entry I will expand on the idea of why you will want to create many more different content types of your own.