Drupal theming:
from scratch, mashup or
subtheme?

So it's time for you to lay down something original using Drupal, gone are the days of picking a contrib theme. You want inflict some of your own design onto the waiting www. What plan of attack should be implemented?

The main options are:

  1. Find a theme which get's close to what you want then just wade in to the css and mash it up.
  2. Find a theme which get's close to what you want and add your own css files to make your modifications.
  3. Find a theme which can be used a good basis for what you want and make a subtheme.
  4. Build your own theme from scratch.

I'm going to tell you why 3 is better than 2+1 and I'll save talking about 4 for another day.

Options 2 and 1 are ok really, and in all honesty it's how most of us start out. It's mush easier to modify something that already exits than to start from scratch. As long as you get a site which resembles what you initially set out to do then who cares?
There are a couple of major disadvantages to these methods, notably:

  • If a newer version of the base theme is released you can't upgrade without finding all your modifications and re applying them to the newer version.
  • It is extremely difficult, even with good commenting to keep track of all your changes.

So what is so good about a subtheme? The main advantage is that the base theme remains completely unmodified, meaning that you can update when you have to with complete freedom. Secondly, all your changes are all in one place, not wrapped around existing code, so it's much easier to see exactly what you were up to at 3am drunk on coffee the night before.
Importantly, you only make changes where needed, if a css class isn't declared in your subtheme then drupal just looks for it in the base theme and if it's not declared there drupl looks for it in the default drupal css. Same goes for template files.

Building your subtheme

At it's most basic all a subtheme needs to consist of is an existing base theme, a folder in your themes directory called whatever you want your theme to be named and a .info file of the same name in that folder.

I'm going to call my new subtheme simonelliott and use NineSixty as my base theme. To begin with my themes folder will look something like this:

  • sites/all/themes/ninesixty/ninesixty.info
  • sites/all/themes/ninesixty/ all the other theme files
  • sites/all/themes/simonelliott/simonelliott.info

Your .info file should include at least the following as a minimum.

  1. ; $Id:
  2.  
  3. name = Simon Elliott
  4. description = My new subtheme
  5. core = 6.x
  6. engine = phptemplate
  7. base theme = ninesixty

The first 2 lines provide the name and description of your subtheme for the theme selection interface at /admin/build/themes in your drupal install. The third and fourth tell drupal which version of drupal and which templating engine your theme has been designed for. The last line simply states the base theme to which your subtheme belongs.

With this file in place you can now enable your theme at /admin/build/themes although it will be identical to your subtheme.

The first thing you are likely to want to do is modify some css, this requires two things, first we need to create a new css file in your subtheme folder then we need to tell drupal about your new css file.

Create an empty file sites/all/themes/simonelliott/simonelliott.css

Then add the following to simonelliott.info anywhere at the bottom

  1. stylesheets[all][] = simonelliott.css

You will need to flush your cache for drupal to see these changes.

You can now add all your css changes to your new css file and they will override any existing css.

If you need to make changes to the template files in your base theme just make a copy of the original and put it in your subtheme folder and hack away. You will need to flush your drupal cache everytime you add a new code file to your subtheme.

Drupal will look in your subtheme folder for page.tpl.php first, if it doesn't exist there then drupal defaults to your base theme folder and if it still can't find it drupal will use the default page.tpl.php.

If you want to add extra regions to your site just declare them in your subtheme .info file and use them as normal in your template files.

Please be aware if your theme or subtheme uses only the default drupal regions, left, right, content, header, and footer these are not declared in the .info file. If you want to add an additional region to these defaults then you have to declare the defaults too.

This will give the default regions

  1. ; $Id:
  2.  
  3. name = Simon Elliott
  4. description = My new subtheme
  5. core = 6.x
  6. engine = phptemplate
  7. base theme = ninesixty
  8.  
  9. stylesheets[all][] = styles/simonelliott.css

This will give the default regions plus one custom region

  1. ; $Id:
  2.  
  3. name = Simon Elliott
  4. description = My new subtheme
  5. core = 6.x
  6. engine = phptemplate
  7. base theme = ninesixty
  8.  
  9. ;Regions
  10. regions[left] = Left sidebar
  11. regions[right] = Right sidebar
  12. regions[content] = Content
  13. regions[footer] = Footer
  14. regions[header] = Header
  15. regions[content_top] = Content top
  16.  
  17. stylesheets[all][] = styles/simonelliott.css

DRUPAL THEMING: FROM SCRATCH, MASHUP OR SUBTHEME?

Glad to visit this professional blog... I would love to learn more and more about technical and programming related things.. Great work! domain registration and hosting india

very good

You made various nice points there. I did a search on the subject and found a good number of persons will have the same opinion with your blog.Chicago remodeling

I am very enjoyed for this

I am very enjoyed for this blog. Its an informative topic.It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.I think it may be help all of you.Thanks a lot for enjoying this beauty blog with me.how to remove skin tags

Its opportunity are so

Its opportunity are so fantastic and working style so speedy.I think it may be help all of you.
Ferienhäuser Sondervig

Nice post

This looks absolutely perfect. All these tinny details are made with lot of background knowledge. I like it a lot. This was a useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful.sameer thapar

mobility scooters

Thanks for the marvelous posting ! I definitely enjoyed reading it, you might be a great author.
mobility scooters

All information mentioned in

All information mentioned in this post is too good can be very useful. I will keep it in mind, Thank you for sharing information about more posts.Thanks expectations, and maintain updated. Deals

Thanks for sharing this

Thanks for sharing this information. I really like your way of expressing the opinions and sharing the information. It is good to move as chance bring new things in life, paves the way for advancement,
"new york marathon"

ibiza

Very significant post about Industry Alert. I would like to appreciate your work and would like to tell to my friends.
hostel ibiza

The dazzling thing about this

The dazzling thing about this article is, it's has a first-class content, and I truly connect significance to you for giving out such an wonderful information among us, Thanks! counter strike 1.6 download for free, download spiderman 3 for pc, download full version need for speed most wanted

Now that was a really healthy

Now that was a really healthy dialogue right there. Gets your blood pumping really fast and strong. Thanks a lot for sharing this with us strategy games

Really nice , I enjoyed it

I just wanna say thank you for the information that you have been shared to us readers. Thanks for posting this kind of theme.
professional research paper writers

find a freelancer

So helping post.Having a lot of information,s.Keep sharing such great and informative posts.
find a freelancer

It is great post to help

It is great post to help solved issues of druple seo. I recomended this blog to follow medium of RSS and social media trade shows

I am very enjoyed for this

I am very enjoyed for this blog. Its an informative topic.It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.I think it may be help all of you.Thanks a lot for enjoying this beauty blog with me.mole treatment

I am really enjoying reading

I am really enjoying reading your well written articles. I think you spend numerous effort and time updating your blog. I have bookmarked it and I am taking a look ahead to reading new articles. Please keep up the good articles!
-motor trade insurance

Simply, admirable what you

Simply, admirable what you have done here. It is pleasing to look you express from the heart and your clarity on this significant content can be easily looked. Remarkable post and will look forward to your future update.
India tours

I have been reading blogs on

I have been reading blogs on this subject for a few hours now and your content is the most informed I have read thus far. Thanks for putting this information in one place.
recession proof career

Thanks for providing this

Thanks for providing this script. I tried it on my website and it worked !! Any possibility to change some attributes from this script?
Website Design India | SEO India | SEO Experts India | PHP Developers

I just did somethign wrong

I just did somethign wrong when creating my own drupal theme by makin a subtheme of the zen theme from the STARTERKIT:

I copied the file layout-fixed as it is without changing it's name to layout.css - which seems to be what you have to do, and what the nice helper script does.

But I want to be able to change between the fixed and the liquid setting in the admin menu.
How can I do that? java programmer

Good Blog Post

Hi there,Really nice job,There are many people searching about that now they will find enough sources by your tips.Also looking forward for more tips about that topic.
Persuasive Essays Help

You're so cool! I don't think

You're so cool! I don't think Ive read anything like this before. So good to find somebody with some original thoughts on this subject. Thanks for starting this up. This blog is something that is needed on the web, someone with a little originality. Good job for bringing something new to the internet!
-motor trade insurance

Is it possible to change some

Is it possible to change some attributes from this script?
birthday gift baskets

myrealfun

This is just wonderful, I really like the theme of your blog and the stuff here is really very informative.Download  Movies,Songs,Games,Blogger Templates & much more.

zoobygamez

Thanx for sharing all these wonderful Posts and Blog.I really like them and looking forward for the newposts. Download Download Free Pc Games  from Zoobygamez.

I’ve decided to make it open

I’ve decided to make it open source so that it’s freely available to anyone interested in learning how mouse gestures are implemented. I will be also be posting new releases regularly so that non-developers can benefit from mouse gestures. professional personal statement writers

This is a great post it was

This is a great post it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it.
-french riviera

there is so much that you can

there is so much that you can do with these theme. The design of them is so good. The creators did such a great job with it. payroll accounting

I want to express my

I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.
Dave @ van insurance

RE

Drupal themes are kind of a pain. I love drupal but wordpress is so much easier for getting custom themes. how to learn french fast

CSS not loaded

styles/simonelliott.css is not loaded for some reason.

Regards,
Projektowanie Stron

There is an important D6

There is an important D6 sub-theme (and sub-sub-theme) bug, #481142: Theme settings forms are not inherited by sub-themes, with a patch by Zen's maintainer that seems to work but has been waiting for review for a long time.

check and cash

In order to solve energy

In order to solve energy consumption and pollution problems that incandescent bulb and compact fluorescent lamp have caused, TESS recently released a series of LED lighting products
ranging from LED bulb, LED PL (BB type) lamp to LED tubes So far, TESS has completed a total solution that can replace most domestic lighting products people use nowadays such as incandescent bulb and compact fluorescent lamp.

tuISFJbnTIxjOivuChC

Kjv0fY I read online (computer problems) positive feedback about your resource. Didnt even believe it, and now saw myself. It turned out that I was not fooled!...

After study a few of the blog

After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon.

exterior doors

I was very much in need of

I was very much in need of this.i trying this for some days now after getting this article i am confident about using this completely.
Diamonds by the Yard Necklace

Die Hausratversicherung

Die Hausratversicherung Testsieger finden
Einen Finanztest machen.

One of the reason I enjoy

One of the reason I enjoy usingname ideas Drupal is it got a very attractive design and there are plenty of themes to pick from.

Hi!

Impressive stuff here!The information and the aspect were just wonderful. I think that your viewpoint is deep, it’s just well thought out and truly incredible to see someone who knows how to put these thoughts so well. Good job! Teach your kids about potty training.

Actually, I'm kind a like the

Actually, I'm kind a like the software. Really attaching and useful. I download in some sites on the web. And surprisingly, I really gave in the software. It's totally useful to me. I used this software almost everyday. Thanks a lot, because of this review I knew this software.
Hotels in Thailand

Den

Den Autoversicherungsvergleich machen.
Die Vollkasko finden.
Eine Vollkaskoversicherung testen.
Eine Unfallversicherung privat testen.

This is one useful tutorial,

This is one useful tutorial, I was looking for it. I was to going to create new css. Now I'll be easily.
Pool design

how much coding

How much coding do you actually have to know in able to create a Drupal theme from scratch. candy gift baskets | radio frequency welding

Re:

I visit this site regularly and I love reading blogs posted here. I have this site already bookmarked in my browser. Thanks for this post. mobility scooters

I was trying to build sub

I was trying to build sub theme but I wasn't get succeeded. Will be try again.
Cool Joshray

This is a great inspiring

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post Run A 10k

Theming

This is a useful tutorial. Just needed to create a new css file in the subtheme folder then informed drupal about the new css file : tropitone patio furniture.

Actually, I'm kind a like the

Actually, I'm kind a like the software. Really attaching and useful. I download in some sites on the web. And surprisingly, I really gave in the software. It's totally useful to me. I used this software almost everyday. Thanks a lot, because of this review I knew this software. New Balance 993 Review

Kreditkarten im

Kreditkarten im Vergleich.
Eine kostenlose Kreditkarte testen.
Wie Kreditkarten funktionieren.

The information is really

The information is really practical and easy to do. Just recently created a new css file in a subtheme folder then I just needed to tell drupal about the new css file. It aided me to finish my bad credit payday loans project.