Drupal Theming – Things to keep in mind to DIY

  • By :Shefali
  • Date : 20-01-2017

So you want to build a classy – swanky new Drupal website and have already checked out hundreds of responsive themes available out there but there’s none that meet your expectations. What do you do? You develop your very own custom Drupal theme from the ground up. Creating your own theme is not as complicated as it sounds if you have a fair knowledge in Drupal.

There are a plethora of powerful and sleek looking themes that you can install and use – both free and paid, like Bootstrap, Zen, Omega, AdaptiveTheme, Skeleton etc. Once installed, if you can figure out the files structure and which files to modify according to your design, you would probably need to locate and modify some lines of code. This can be very tricky and the entire design might just collapse like a house of cards if you mess something up. Building your own Drupal theme can be your saviour. So if you have a decent knowledge in Drupal, CSS and HTML you should find it interesting and fun to do it yourself!

Things to remember before Theming

To go about theming, you will need to design the appearance using tools like Photoshop, Illustrator etc. You will also need create a CSS file to control the layout and change the HTML output of Drupal in order to fit the design. So compiled below are a few key components you will need to keep in mind before you start your Drupal theme development:

Info Files

These files are most vital while creating a theme. Without a .info file, Drupal will never know that you have created a custom theme. The .info file is basically meta data that will contain some basic valuable information about the theme, the files and features the theme will make use of.

The three most key properties that are mandatory are Name (the name of your theme), Description (a short description of your theme) and Core (the version of Drupal you are using). You can also define the .CSS and Javascript files that your theme needs to use. You can also mention some Features that you might want to use like logo, slogan, favicon, main menu etc. and the Regions that you want to display to place blocks of content.

Folder Structure

So you will need to create a folder with a unique name under this directory - Sites/yoursitename/themes. Under your custom themes folder you can also create folders for Images and CSS files if you want to be more organized.

Template Files

Template files mostly contain HTML and a little PHP code and this is where the real theming work happens. It controls the overall layout of your site and are defined with the extension “.tpl.php”. A page can contain a number of template files like page.tpl.php, region.tpl.php, node.tpl.php, block.tpl.php. Some of these template files like node.tpl.php and block.tpl.php can be re-used when presenting a page. So you will just have to create mark-up for them once and then keep using it whenever you want to.

Recent blogs

I always had good feeling about mobile ecommerce; the best practices to make shopping (on mobile) simple, easy, quick &...
Ecommerce Site Search
I always thought it was just me (maybe a few others) who would directly head for the small magnifying glass or the search menu on...
What are Top eCommerce Companies doing to get it right?
Here’s some bitter truth – about 8 out of 10 eCommerce companies fail within the first two years, even when the eCommerce market is...