How to Do Your Best with Drupal

Drupal is a powerful content management systemInstall Drupal created by wed developers from all over the world. It is free to use. Using it you can create any site including your personal simple blog as well as complex site with a lot of pages and visitors. Thanks to powerful API, a lot of modules and themes available, Drupal can meet all your requirements.

Drupal was originally written by Dries Buytaert in 2000. The name Drupal refers to Dutch word “druppel” that means drop.


First of all, you need to register as a user on the right of the main page in a small form ‘User login’. Create a new account indicating your user name and email address. Then, check your email for password and username to confirm your registration. Now you can log in and start to create your own site.

Installing Modules

It is quite easy and should not cause some problems:
1. Unfold the folder with module
2. Download this module into the directory Drupal folder /modules/
3. After downloading, you should activate module into the section “Administration” -> “Modules”
4. Module is installed

How to Create Theme for Drupal

Today you are able to combine various templates and PHP files to create a theme for Drupal. Thus, it can be .theme PHP file that contains Chameleon, or it can be template file (.xtmpl, .tpl.php) for XTemplat or PHPTemplate engines such as Pushbutton or Bluebeach. You also can create pages for existing template such as Marvin or Box Cleanslate.Drupal Modules and Themes

Here is the directory structure of the above mentioned sample:


Themes and templates are located in their own subdirectory in the folder /themes/. Template engines check every subdirectory for template files. In case there is style.css file in this folder, it also will be used.

You can make themes that are based on CSS only creating subdirectory in the directory of any theme and put there new style.css file. Drupal combines new table style with template it is connected with and makes it available as a new theme. Thus Marvin and Box Cleanslate themes operate.

In case there is screenshot.png file in the directory of the theme, Drupal displays it on the screen of theme administration.
Creating Unique Themes

If you need to create a unique theme you can modify already existed theme or start from the beginning. In case you prefer modifying existing theme, just copy it to a new directory into folder themes. Then, change this theme as you like. You can use PHP or XHTML/CSS to modify a theme taking into consideration whether it is a template or it is based on .theme file. As we have already mentioned above, if you just want to change CSS themes you should add new style.css file to subdirectory of the theme and it will appear as a new theme in Drupal.

There are several methods if you want to start on your own. If you don’t have a vast experience in web developing, template engines is the best solution for you. Drupal includes XTemplate engine by default. Look for the special documentation concerning XTemplate for more information. Many themes for Drupal are also written in PHPTemplate.

Xtemplate Theme Engine Explained

The XTemplate theme system uses templates to layout and style Web pages. Using this system to create and modify templates with XHTML and CSS is quite easy due to separation of structure (XHTML/HTML), logic (PHP) and style (CSS). Thus, you can stop worrying about difficult PHP coding.

In other words, XTemplate templates are directories with XHTML/HTML, CSS, image and JavaScript files that are necessary for a template. Templates can be found in the themes directory of a Drupal installation: /themes/ If template exists in the themes directory, XTemplate auto-detects it, and makes it available for selection to administrators: administer -> themes
Drupal is available with two XTemplate templates included – Bluemarine and Pushbutton.

How to Create a New Template for Drupal

First of all, you need to create a new directory in /themes/. The name of your directory should be similar to the name of your new template. For example: /themes/wbd/. As soon as you create a template in this directory it will appear on the page of template selection under the name ‘wbd’.

The simplest way to create a new template is to copy existing template such as Default or Pushbutton and change everything in accordance with your preferences. The only file that is necessary in the directory – xtemplate.xtmpl, that is a usual HTML or XHML file with some XTemplate tags, you can edit in DreamWeaver, BBEdit, GoLive or any other application that you like.

All other files are selective and are taken from xtemplate.xtmpl file. It can contain CSS, images and JavaScript files. They should be included into the template directory so that you can customize them and transfer easily.

Template Creation Basics

xTemplate creates Web pages just substituting place holder tags in a template, the xtemplate.xtmpl file, with content from the database.

There are such types of template place holder tags as section tags and item tags.
Section tags are connected with the structure of a Web page and mark areas of the page. They look like this:
<!– BEGIN: title –>

<!– END: title –>
Some section tags marks can be repeated. For example, the comment section that can be repeated not even once:
<!– BEGIN: comment –>
<!– END: comment –>
Section tags can also look in such a way when one set of section tags can be contained by another:
<!– BEGIN: node –>
<!– BEGIN: title –>
<!– END: title –>
<!– END: node –>
Item tags are place holders for content items, such as the title of a page or the main content of a page. Item tags look like this:
Item tags are associated with the section tag that surrounds them, for instance:
<!– BEGIN: node –>
<!– END: node –>
The {title} tag above is the main title of a page, while the {title} tag below is the title for the comments on a page.
<!– BEGIN: comment –>
<!– END: comment –>

Limited Access to cron.php File

Cron executes various commands at specified intervals. It is available on Linux, Unix and Mac servers. There are no some grave consequences connected with this file, but the second execution of cron.php will be blocked. You can limit access to cron.php file from script to crontab only using allow form in file .htaccess:

<Files cron.php>
order deny,allow
allow your IP
allow 123.456.78.90

Big Size of Tables cache, sessions, watchdog, accesslog

Pay attention to size of tables for logs such as watchdog, accesslog. As a rule, they delete unnecessary info in case the site works properly. This process has a schedule so it is rather important that cron.php was executed correctly.

In case you use MySQL some tables with constantly updated content such as cache, session can become rather big because of empty space that left after the info is deleted. Of course, the real size of data will be not excessive, but such tables take a lot of space. Thus, it is better to optimize such table once a day, for example. Here is the script that should be put into root catalog of the site and installed into Cron the same way as cron.php:

include_once “includes/”;
db_query(“OPTIMIZE TABLE {cache}”);
db_query(“OPTIMIZE TABLE {sessions}”);
db_query(“OPTIMIZE TABLE {watchdog}”);

Wrong Detection of GD Version in Image Module

In case you install GD1, but have image magick and GD2 in image module settings you should change the following in image module:

if(function_exists(“imageCreateTrueColor”)) {
$libraries = array(“imagemagick” => “imagemagick”, “gd2” => “gd2”);
else if (function_exists(“imageCreate”)) {
$libraries = array(“imagemagick” => “imagemagick”, “gd1” => “gd1”);


$libraries = array ( “imagemagick” => “imagemagick”, “gd1” => “gd1”, “gd2” => “gd2” );

6 Steps to Make Drupal Work Faster

  • Turn off all the modules that are not used in the module list;
  • Turn on cash to increase speed;
  • Turn off mod_rewrite in .htaccess. URLs will be not so short and neat, but many CMS don’t use short URL;
  • Module locale influence greatly on speed of your site. You can adjust it with gettext and check whether improvements appear. You also can just turn off locale, but it is not required;
  • XMLtemplate themes are slower than PHP. Thus, check which theme is used by default and if you have something like xtemplate with XML template, change it for PHP (for example, chameleon);
  • The information about all accesses to database slows down Drupal. Activate module devel and check the time of all the accesses execution. Try to turn off some modules (standard as well) and check whether something improves.

If Cron is Not Available

Most tasks in Drupal such as text indexing, email sending, etc. are scheduled. It is possible because of cron.php. In case you can’t script call in crontab you still can do the following:

  • Ask someone who has access to cron to activate the script for your cron.php;
  • Install poormanscron module that process set tasks using the scheme applied for many CMS.

Popular Drupal Modules

  • Banner – allows you to display ads;
  • BBCode – adds a BBCode filter that allows you to use HTML-like tags;
  • Captcha – block form submissions by spambots;
  • Ecommerce – to create your own online store;
  • Fckeditor – HTML text editor;
  • Gallery – embeds Gallery2 to support photos, videos and other content;
  • LDAP integration – embeds LDAP;
  • listhandler – mailing list discussions and Drupal forums;
  • Project – provides project management for Drupal sites;
  • SPAM – include spam filters;
  • Swish – implementation of the open source Swish-E Search Engine;
  • Textile – implements the popular Textile markup shorthand.

More Drupal Modules Reviewed

Some extra Drupal modules should be download and installed from official sources of Drupal so that they work properly. Here is the list of not so popular, but still quite useful Drupal modules that can help you to make your site look and work better:

Guestbook – it provides you with a site guestbook with individual user guestbooks. You can delete and comment guestbook entries as well as choose avatars if they are available.

Сontextlinks – allows to create links with a simple markup syntax. You can indicate the links with text itself or some icons.

Taxonomy Multi Editor – a mass category editor.

Ecard – you can look through cards gallery, choose the card you like, write some text if necessary and send it with email address.

Taxonomy Context –allows to create a hierarchical menu tree for each vocabulary.

Database Administration – provides direct access to Drupal database tables.

Simplenews – publishes and sends newsletters to lists of subscribers.

You can download the above mentioned modules from official website

How to Display Popular Articles

First of all, you should activate statistics (administer/modules) module that is available within standard Drupal. Then, go to module settings (administer/setting/statistics) and activate indicator that display articles. Go to administer/blocks and activate “Popular content”. Don’t forget to configure it. For example, you can choose to display the most popular articles for a day, all time or just most recent views.

Comments are closed.