Convert any website layout or template into a Drupal theme – easily!
Theming for Drupal is not actually as hard as you may think. Certainly there are more advanced areas of theming possible with Drupal, which may or may not be necessary depending on the needs of your site or whether there are subtle defaults which you wish to change (and which you can learn about if and when they become necessary for your site). Creating the “overall theme” for your site though is very simple.
A Drupal theme is nothing more than a standard website layout, with a few bits of PHP code added in certain places, which you can simply copy/paste into place in order to call up Drupal’s “dynamic” content and features in those spots.
If you learn better visually, videos are available which cover much of the same information that will be illustrated here: Acquia Webinar.
Contributed/downloaded themes are more complex than “your” theme needs to be
You may have looked at various pre-made themes that either come with Drupal core or are available for download, and sighed with frustration upon seeing their code. To some, the code looks very confusing.
Keep in mind that those themes have been created to address the needs of many people. The themes must be able to handle all kinds of scenarios, which means they have been designed to allow you to dynamically add various columns and other layout elements, and to support custom theming for features and modules which you might not even need. These themes usually include a large amount of PHP code that essentially says, “If this setting is true, then show this part this way, or else show that.” This makes the theme very flexible, but also very complicated.
However, your theme doesn’t need to work for everyone. It only needs to do the things your site requires and nothing more. All that you need are a few bits of PHP, which you can simply copy and paste into your own HTML template. These PHP snippets tell Drupal to load its dynamic content in those spots.
You might also find it useful to have a look at Drupal’s “most basic” core template files (those used when a theme doesn’t provide any alternative template files to override them). To view these basic templates, look in the /modules/system folder of your Drupal installation (in particular, look at page.tpl.php and node.tpl.php).
Just a few simple & basic elements make up a Drupal theme
The “main” template file in Drupal is called page.tpl.php. Make a copy of your website layout/template and call it page.tpl.php. Then, simply paste the following bits of code into your layout, in the locations noted (all the code mentioned in this lesson goes in the page.tpl.php file).
2 thoughts on “Convert any website layout or template into a Drupal theme – easily!”
Excellent beat ! I would like to apprentice at the
same time as you amend your web site, how could i subscribe for a
blog web site? The account aided me a acceptable deal.
I have been a little bit acquainted of this your broadcast offered brilliant clear concept
I don’t even know how I ended up here, but I thought
this post was great. I do not know who you are but certainly you are going to a famous
blogger if you are not already Cheers!
Comments are closed.