Category Archives: Drupal

How to create or customize drupal theme

I thought that I am programmer, but recently I also did a lot of front end job. This post will help the guys want to find out how to customize drupal theme.

For customize or create a new drupal theme, you don’t need to understand the php just need some knowledge about the HTML and CSS then will make you successfully create or customize drupla theme.

First, you need understand the construction of the drupal page. See below the picture, that is the most common useful template.


Second, here is your theme direction should look like


third, those three need have the same name


Now we could start now. go to find this file


here is the header



Here is your page.tpl.php


the rest of just css and javascript:









Tips for use Drupal

Tip1: After install new module,should go Administration › People › Permissions, set permission, otherwise won’t work.

Tip2: Drupal built a lot of caching mechanism to improve performance, but in a development environment, it is best to turn off all to see the results of the fastest changes.

Into the background

administer -> configuration -> perfromance 


  • Cache pages for anonymous users
  • Cache blocks

Are unchecked.

In addition, to make the theme changes take effect immediately, you need to at the top of the theme template.php join


Tip4: Avoid modifying Drupal core files

In the file structure of Drupal modules and themes can be installed in drupal / modules , drupal / themes , it is also possible to install in drupal / sites / all / modules , drupal / sites / all / themes under. Recommended to choose the latter, which is the official recommended. Because this way, you can modify the project focused on the sites directory when upgrading Drupal version, you can cover all the core files directly without having to have another worry.

Of course, since the Drupal web root directory is set in the root directory of the code, from a security point of view, then pay attention to the library may be accessed files, so you can control what file permissions in addition to sites outside the directory.

Tip5:error when processing Drupal

Since  Drupal has error handling php, when there was error occurs, the screen will appear

The website encountered an unexpected error. Please try again later.

Generally , you can go Administration › Reports › Recent log messages, view the error message.

But sometimes occurred if the situation worse, such as the installation of some modules may report the above error and you can’t access the back control.

So then you can go check watchdog, variables field holds this error message, you can notepad to  open it to see the error details (which you need Database logging module).