Advice on Creating Drupal Themes

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

I have started to read the Drupal handbook on creating a custom theme, but it certainly is a lot of reading and material to go over. Does anybody have any tips or further resources on custom Drupal themes?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Look for one of the simple base themes in the theme directory and work from there. That's probably the easiest way to start. The theme for TWF is based on grid_inspired. The site I developed at work was based on Hunchbaque.

You might need to copy in some .tpl.php files from one of the default themes if they're not included in the one you're using.

silverwing's picture

He has: 79 posts

Joined: May 2008

Like Megan said, take a current theme (make sure they have the .tpl.php files) and start with that. (All the themes in my signature started life as danger4k but evolved.)

I'll assume you have a WAMP/XAMPP/MAMP like setup on your local computer to emulate a webserver. That's saves a lot of time!

~silverwing

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Seems like most of these themes are for versions 5.x and not 6.x. Should I be developing with 5.x? What is this site using?

silverwing's picture

He has: 79 posts

Joined: May 2008

pr0gr4mm3r wrote:
Seems like most of these themes are for versions 5.x and not 6.x. Should I be developing with 5.x? What is this site using?

You pick the version that has the modules you need that are ready. I use 5 because the modules I need (views, pathauto, a couple others) aren't stable for 6 yet. In fact, I may just skip the whole version 6 and just use 7 when it's ready.

Many of the modules are going through code changes, thus not being ready for 6. Getting them ready for 7 shouldn't take this long.

~silverwing - recommending 5

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

We're using 5 on the main site here. The site I'm working on at work is using 6, but it's not ready to be launched yet so I'm not worried if I'm using beta versions of modules. If you plan to launch soon, use 5. If you've got a couple of months development time I'd say go with 6.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

I agree that you are better off using v 5.7

Some major modules still available in v 5 and not 6 include Ubercart (ecommerce) and the amazing Workflow-ng

However, I am also using v 6 on one site that is mainly about forums - because the v 6 forums are nicer, and the AJAX dragndrop widgets make admin easier for client...

So it depends on what you're doing

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

well, when I am working from psd I use a very basic theme like Framework (although Zen might work out too haven't really tried)

You will need a good css inspector like the Firefox plugins Web Developer and/or Firebug

You will need to be comfortable making some minor edits in the php template files, mainly moving a section or commenting it out. You may also need to add custom css classes or ids.

When adding css make sure to place it at the end of your theme stylesheet so it overrides earlier values. If you change the css in a module's stylesheet, you are likely to lose the changes when you upgrade the module.

Refrain from editing the core Drupal php and stylesheets as this is considered "forking" and will leave you stranded when future Drupal releases come out. Edit your theme files to your heart's content. You can even rename the directory of the theme and make it your own, If you come up with a really unique and error-free theme, you can contribute it!

Some sites I have created this way include http://4m.netsperience.org/ with customization of the Nice Menus module css and custom theme search box with a button image added in css. This is a basic two column theme I am not using the right column.

At http://jcat.netsperience.org/ I have hidden the entire Drupal front end, because client does not now want the community features but I bet your sweet bippy (remember the Smothers Brothers? - oh brother, showing my age again) anyway I am sure they will want them later and rather than panic I will just roll them out from the backend. We are also using the Drupal CMS, this simple looking page is a node with 2 or 3 nodes embedded in it. For admin I created a custom admin page http://jcat.netsperience.org/manage/adminjc.html

Anyway, this is my approach when working from a total design like a psd.

I do also adapt themes such as the Ability theme here http://hcshc.netsperience.org/ and my personal site http://netsperience.org/ adapting the 4 seasons theme (I just switched servers/hosting cos and getting some stupid DNS issues settled)

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Thanks for the advice everyone. It doesn't feel right developing a new website with 5 when 6 is available, but that's what I will probably do. It can always be upgraded I guess. I'm surprised it's taking this long for everyone to update their themes and modules for the new version. It's not even that "new" anymore, being 6 was released almost a year ago.

silverwing's picture

He has: 79 posts

Joined: May 2008

There's nothing wrong with 5.

Like I said, a lot of modules decided to undergo some code changes for Drupal 6 and it just took longer than expected. And because of that, a lot of people haven't upgraded to 6 so they still need 5's modules and support for 5.

Once more of the modules are released as stable for 6, getting them working for 7 won't be as bad.

~silverwing - d5 apologist

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

from what I understand the Drupal core in v 6 has a completely new menu system and a few more major changes

so module maintainers in many cases need to rewrite a great deal of their code - it's not a minor upgrade

and let's remember that in the Drupal paradigm, these maintainers are essentially volunteers who probably created the module a couple of releases ago to solve a specific problem and now are responsible for updating it each time the Drupal core is updated

which is why anybody with php and mysql chops who has spare time should go to http://drupal.org and find a module to help maintain - you will be appreciated and will be making a substantial contribution to the Drupal and open source community!

They have: 11 posts

Joined: Jun 2008

I've taken to building my own base theme and customising it for each project. I decided to go about it this way because my own base theme is already customised halfway, compared to starting customisations from scratch with Hunchbaque or Framework.

I modified my base theme from Zen. I like Zen, but I think it tries to do too much.

Also, I agree with silverwing. Drupal5 is solid and it works.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I tried zen before Hunchabaque and I agree with you. It was too much, I needed something simpler.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.