David Slack - Web developer

Drupal theme - Create Folders and Files

First thing we need to do is create the folders for the theme in the correct places then create the files that are needed. So lets start with the main folder. There are a few places to put your theme but we will use the standard so as not to mess up any updates and make the theme easily movable.

We will use the design for Dodgey Daves Discount Emporium so make sure you have the Fireworks png to hand.

  1. Navigate to /sites/all/themes (create the themes folder is you need to)
  2. Create a folder with the name of the theme, ours will be 'dodgy_daves' (don't use spaces or caps)
  3. In the main folder add a 'styles' folder and and 'images' folder
  4. Make sure there is a '/sites/all/fonts' folder which is where we will keep any fonts

Now we have all the folders we need we should create the files

In your main folder '/sites/all/themes/dodgy_daves' create:

  • print.css
  • style.css
  • script.js
  • block.tpl.php
  • comment.tpl.php
  • node.tpl.php
  • page.tpl.php
  • template.php
  • dodgy_daves.info

Make sure all the files are empty. The last file MUST be named the same as the main theme folder with the extension .info, so in this case 'dodgy_daves.info'.

Now we have the files in the correct folders it is good practice to add some info about each file to the top of each file. First we will set up all the php files. Open the 5 php files and at the top add in some info. For block.tpl.php we will use:

<?php

/**
 * block.tpl.php 06/04/2011 for dodgy_dave theme
 * Created by Dave (blah@davidslack.co.uk)
 * Edited on 07/04/2011 by Dave (blah@davidslack.co.uk)
 */

?>

So for each file you have the open and close php tags, a comment with the file name, the date created, the date edited, and who did what. Some systems do this automatically for you but its good practice weather its done manually or automatically.

Now do the rest of the files with the same type of info. .css files use the same comments and so does the .js file so you can use basically the type of thing. However, the .info file needs a ';' infront of each line so use something like:

;
; dodgy_dave.info 06/04/2011 for dodgy_dave theme
; Created by Dave (blah@davidslack.co.uk)
;

 

Latest content

There are lots of developers out there with varying degrees of experience and expertise, some mid level, some junior and some senior. Some...
First thoughts are Symfony is ace!Only been using Symfony for 1 project but the amount of coding it has saved has been worth the time spent...
The Lost and Found website was built by myself (David Slack) and designed by Arm & Eye.The site was created to promote a bar and...

Social networks

Contact me here or catch me on one of
the social networks below


What I'm listening to

My blog

Wednesday, 2 August, 2017 - 06:56
There are lots of developers out there with varying degrees of experience and expertise, some mid level, some junior and some senior. Some developers...
Tuesday, 5 March, 2013 - 09:49
First thoughts are Symfony is ace!Only been using Symfony for 1 project but the amount of coding it has saved has been worth the time spent learning...
Monday, 3 December, 2012 - 10:07
As a web developer and web designer I need to take into account everything on a site from SEO, marketing, usability across devices, the look and feel...

Try this on your mobile

Use your QR reader to read this

You should be able to use this right from the screen

Latest tweets

You are here

Back to top

Copyright David Slack - Web developer