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.

Subscribe For Our Newsletter And Stay Updated

Recent blogs

DrupalCamp 2018
“Everyone you will ever meet knows something you don’t” - said Bill Nye popularly known as The Science Guy, who (coincidentally)...
expert_talks
Drupal 8 is not just packed with features that alleviate digital experiences for the end user but is also making life easier for...
ecommerce sales
As an e-commerce marketer, you are always looking for new ways in which you can drive traffic to your e-commerce site and boost...

This website uses cookies to offer you an enhanced website experience. We collect information about how you interact with our website to provide personalized services to you. To find out more, see our Privacy Policy

×