Note: I'm going to start regularly answering questions I get via email by blog. The reason being that email is a blackhole; and I am getting too many good questions everyday. When I have a few moments to answer, I figure I should make them available to everyone.
A reader by the name of Fouad writes:
Hi, I went through your tutorial on drupal themes, but it required a lot of programming experience. Isn't there an easier way to put together a drupal theme? For example, what if one wanted to start with an empty page, and build their theme from the groundup?
...is their a straight forward process to make 2 column/row, 3 column/row, 4 column/row themes?
Drupal themes are very straight forward... ...provided that you understand why they are straight forward, and why a more straight forward way is difficult (actually, impossible at present... that may change in Drupal 4.8 or 4.9).
Now, for the 99.999217 percent of the population that doesn't understand why drupal theming is straightf orward, I have bad news. You've got a lot of learning to do. In the beginning, the task of learning how to build a solid drupal theme is going to appear daunting, painful, confusing, sadistic, cruel, unusual, and most importantly, boring. I know these things because it wasn't long ago that I first started teaching myself HTML/CSS/PHP and began to learn how to apply it to drupal (November 2004). So forgive a LONG answer to a question that sought a short answer. Rest assured a short answer would have been a fairy tale.
In this post, I will attempt to provide those with little to no experience in web design a place to start. Let's begin with this overly simplistic but practical picture of what a drupal theme is:
Drupal theming is an application of CSS/html/php programming. To ask "how can I learn theming without learning HTML, CSS and PHP?" is like asking, "How can I learn Jazz piano without learning how to play the piano?".
The human body serves as a metaphor for the parts of a drupal theme (my guess is that we all share that in common). Roughly speaking:
Layer 1: the Skeletal system. The HTML markup serves as the foundation for which the rest of theme depends. Without a basic understanding of HTML, you'll deprive your theme of a normal, and solid bone structure. You're theme will be deformed, weak, and probably collapse, and die at very young age. Clearly, this is a scenario that should be avoided altogether if possible. Start here, if you're just beginning.
Layer 2: the skin, and muscle. The CSS layer is more than merely "skin deep." Lots of stupid programmers think CSS is "not a real language", and is a skill best left to wimpy boys. "Real men", so the argument goes, only code in Java and Python.
This attitude always reveals itself in the ugly interfaces, and ugly, rigid markup their scripts generate. CSS is not only the path to beauty on the web, but it absolutely transforms the presentation of markup. It can make vertical menu trees turn into horizontal cascading tabs. You can markup two sidebars at the bottom of your HTML page, and squeeze them to sit nicely next to your center content. Its also the most artsy of programming languages (imho). In comparison with learning the HTML basics, and PHP syntax, CSS is by far the most immediately rewarding of them all.
Layer 3: PHP -- the nervous system, and heart. Without a brain, or a heart, what happens to people? They die, obviously. The same is true for your drupal theme. PHP is the layer which allows you to transform a dead layout into a live breathing page.
The best metaphor for learning how to build a drupal theme is learning how to play an instrument. If this introduction seems long, than I caution you: you have a long journey ahead of you. The truths about learning a new musical instrument are identical to the truths of learning how to theme for drupal. So, be forewarned:
This is just the honest truth. Its 2006, and building things on the internet is still an occult art. That is why so few people can do it well. If it were easy, and straight forward, than -- there wouldn't be so many terrible web pages.
Everyone begins with no clue as to what they are doing -- I coded my first HTML tag in the summer of 2004. My knowledge has been entirely gained from a rigorous program of aimless experiementations, disasters, and the lessons I've learned from them.
Trial and error is not merely the best way to learn -- its the only way. Luckily, you can at the jumpstart your process by learning from web designers all over the web. And, web designers love teaching.
I took some time to gather the best, most readable, humorous, and free materials to help you start. Take note of the sources in this list. I've made it a point to only select the best of the best sites on web design. It is far from an exaggeration to say that not one web professional is unfamiliar with these sources.
I will divide these materials into "movements" -- merely for the fact that its a musical metaphor that can also be interpreted as a gastrointestinal metaphor. The truth indeed lies in between the two. And I'm werid.
Back to the Basics (alistapart.com, 2001) Do read, web design is as much about philosophy as it is code.
"When you hit a fork in the road, take it." - Yogi Berra
1. Site Point: XHTML Web Design for Beginners part 2
Note that we are starting with part 2 because part 1 is theory that you don't need to worry about yet... or, come to think of it, ever. If you find yourself lost in this tutorial, try this tutorial instead: Sitepoint: The Absolute Beginners Guide to XHTML/CSS'
2. (Alistapart.com): Using XHTML/CSS for Search Engine OptimizationBelieve it or not, the quality of your markup directly affects your sites traffic. See, learning the basics IS practical!
3. (456 Berea St.) Attributes Vs. Tags Vs. Selectors So you can start to sound smart while talking about code :-)
Conclusion of Movement 1:
(456 Berea St.) Top 10 Reasons to Use Web Standards
Forward: (A List Apart): The Tao of Web Design
Selectutorial -- Selectors are one of the most important aspects of CSS as they are used to "select" elements on an HTML page so that they can be styled.
Listutorial -- the basics of building background image lists, rollover lists, nested lists and horizontal lists.
Floatutorial -- the basics of floating elements such as images, drop caps, next and back buttons, image galleries, inline lists and multi-column layouts.
1. (A List Apart) In Search of the Holy Grail Note, the "holy grail" is an inside joke regarding 3 column css layouts. See this old hag for more more background on the joke. I swear its funny if you had one time thought the hag was "the holy grail".
2. (Juicy Studio) Div-Mania! More and more web documents are appearing that consist of nothing more than a collection of div elements. In most cases, better use of CSS selectors could be used to avoid overusing the div element.
3. (huddletogether)Squeaky Clean CSS Tips on how to code CSS without making your life a living hell.
4. (BarelyFitz) Learn CSS Positioning in 10 Steps I wish every CSS tutorial was like this one. Oh, I forgot to mention: in css, position is everything.
I feel no regrets, this is plenty of material to get the intended audience through a full week. Nevertheless, I'll finish this tomorrow evening. If you read me via RSS, I'll post a notice. I'm sure this list will change a lot as time passes... As it turns out, reviewing and reading material for quality is time consuming.
Comments
migrating to drupal
I have built a bunch of client websites using wordpress as my back end cms and am wondering if anyone can tell me how the learning curve of wordpress stacks up against the learning curve for drupal? Wordpress is relatively pain free but has several areas where it's functionality as a full fledged cms are limited. Drupal seems much more robust, but I wonder about how theming it stacks up vs wp.
Drupal theming for designers
Designers interested in getting up to speed on creating Drupal themes may also be interested in Drupal theming for designers
Great post
Just found this post. It's just what I needed to hear... I just have to bite the bullet, but this has given me encouragement to just power through it. I had never written a line of code in HTML before April 2007. Now I know a bit of CSS, and I have been reading the Sitepoint book on PHP/MySQL to get started on that end... then hopefully I will be able to slowly get into Drupal.
Thanks!
what you say is really the truth.
i like the "A "Quick" Sermon for Beginners" part of this article! its really encouraging thoughts! thanks. im beginner to drupal and i think what you say is really the truth.
Thanks.
Muito bom o artigo
Estava procurando algo parecido no google, e encontrei este post no blog, muito bom, me ajudou a terminar o site Orolix.
Simple way to make a Drupal theme
You can make a first Drupal theme by copying Bluemarine from /themes to /sites/all/themes. Then open up page.tpl.php in an editor. Strip out all the HTML tags and just leave the PHP snippets. Those PHP snippets print variables that contain the content. You can find out what each variable means on the PHPtemplate variables page. Add your own HTML to replace the HTML that you removed. Edit style.css to your liking. node.tpl.php themes the nodes and comment.tpl.php themes the comments.
I also recommend reading Chapter 8 of the book Pro Drupal Development
Very helpful BLOG
keep up the good work men! I agree with you! need to have a background on html and css in order to have a good grasp in working with drupal and a basic php knowledge. We started using Drupal and we agree its far better than other CMS out there. And thanks for making this article available to the public. Hooray to the opensource community. Knowledge is free but use it for the good of human kind. kudos to you!
found it
Great inro.
But where do I write and test PHP code?
I'm hosted by Bluehost and have Drupal 5.1 running there.
I need a test (learning) environment to play around, I guess something like what a wikipedia sandbox is.
I an sure I can find something, but I can only be rasonalby comfortable (sure that it fits) if someone like you suggests it. I'm going to look aaround now to see how much Dreamweaver cost and what it does(???).
Waiting for more to come...
Great start. I got the HTML & CSS stuff down cold. Please hook us up the the PHP basics needed to skin a drupal site!
Thanks in advance.
David Martinez
there must be an easier way
there must be an easier way to theme drupal without knowing php etc. for example i havn't even looked at what is in the chunk of code you add to joomla's template but what i care about is the placement of and so on zones and the CSS. that what most people are asking about. anywayi appreciate the effords you do.
easier way
If this way (making your theme from "zero"), you could try to modify existing theme.
Good one to modify (with just changing css) is Drupal Zen Theme.
One of the "mods" is Drupal Bluebreeze Theme.
Many thanks Nick
I'm really delighted that you have take the time to post up the page http://www.nicklewis.org/node/850.
Please ignore idiots who need a quick fix to theming. I donated a few dollars in recognition of your effort - because I know what you have written is good stuff.
Drupal is still very much misunderstood and there will always be impatient souls looking for theming to happen like instantly.
I wish to encourage you to ignore unappreciative comment. Please continue to update the page ever so often. Many newbies will benefit.
Just what I was looking for. Thanks!
Thanks for this. This is exactly what I was looking for. Hopefully by the time I get through all your suggestions I will be able to at least ask educated questions when it comes to this. I have installed both Joomla and Drupal 5.1 and like the Drupal back end better. The only issue is that there are a lot more templates for Joomla so for any near future project I will have to go with that platform and just change around the template a bit. I wish I had more skill, hopefully soon.
useless
sorry but this site is useless, if i wanted someone to tell me to go learn html , css and php , that can be written in one sentence.
what i was looking for when i came here was what the title says, learning how to theme in drupal, starting at square one, however, this site didn't teach me anything related to themes in drupal.
Good theming introduction for non-designer people
I think that this article actually covers subjects skipped in tutorials on drupal.org.
It is good orientation article with quality pointers how to start the Drupal theming when you have not done web design previously.
If you are seasoned web designer going Drupal, you don't need this article. Others will find it useful.
You won't be able to write a
You won't be able to write a drupal theme until you get html, and css basics down first. Once you understand html, and css, than theming is going to make a lot more sense. And, you won't be overwhelming yourself with trying to learn html,css,mysql, and php all in one go. Start slow, get html down first, css second, than php, than mysql.
If you are starting a square one, that's just how it is. Sorry.
gone are the days of
gone are the days of actually learning what you need to get results..., thought this post made a lot of sense. If you want to be able to make beautiful things, you need to put the work in. If everyone could do it just like that, then beautiful would become standard and cease to be beautiful anymore...
Great article, thanks for sharing your wisdom.
Wicked
I'm new to drupal and find your site a brillant start. Like everyone above, I'm keen to get my little head around the idea PHP. Thanks.
Waiting with baited breath
give us the nervous system!
I swear — I will — soon.
I swear -- I will -- soon. I'm very swamped -- its not that I'm lazy -- its that there are times where I have to find balance between my natural propensity towards thrusting my weird code-tutorial-riff-thingys upon the general public, and meeting my day to day responsibilites (which have reached a satirical intensity, as of late).
You say that that you only need to know HTML/CSS with Joomla.
Well... I applaud your sensibility, and good sense in not attempting to go further in Joomla. Because frankly -- when you have to change Joomla's dynamic content's presentation -- life is not worth living -- and one would be better off fleeing to the jungle.
The jungle is full of delicious nuts and berries, I might add.
Thank you so much!
Looking forward to the nervous system!
Thanks for the reference material on drupal themes
php
PHP Tutorials
Good ones on Lynda.com and Sitepoint for purchase. W3Schools has free tutorials...
Email form