Better to start from scratch or Zen?

suppose - June 9, 2009 - 19:58

We have our site already designed and the CSS/XHTML all created. I am new to creating a drupal themes. I have heard mention of zen and other theme starting points. But it seems like these are more for people who don't already have their CSS/HTML created and want to use them as a starting point. Is that correct?

In my situation, would I be better off just creating my theme from scratch using the CSS/HTML I have already created and maybe using zen as a reference for the actual template coding? or should I somehow rebuild it using the zen theme? The second option doesn't seem to make sense to me... but like I said, I am new to theming.

If someone could give me some advice, I would really appreciate it.

I really enjoyed building my

arkjoseph - June 9, 2009 - 20:29

I really enjoyed building my first theme from scratch. but thats just me...I also had the html and css files built prior. what i did was just reference what needed to be referenced from a completely finished theme. (doesnt haveto be zen, could be any theme) Like the 'main menu' 'regions' a custom front page...etc.
-let us know what comes of it

Drupal Newb

After having done it various

redpuma - June 9, 2009 - 20:53

After having done it various different ways including almost from scratch, adapting "Garland", "Framework" & "Clean" and recently started using the Zen theme my advice would be to use the Zen theme. Follow the instructions for creating a new Zen based theme from "STARTER KIT". When building from scratch I've found too easy to leave out important bits of code (tabs for example) which is not always clear why it is necessary when starting out. Zen is very well commented and really helps in understanding what's going on.

Initially we would try and clean up all the tags and nested divs that Drupal would put out in an attempt to have the same type of semantic markup we were used to writing, but that becomes a lot of hard unneccesary work; better to tweak what Drupal puts out naturally than re-write/theme it in many cases. Use your existing HTML/CSS to assist you in getting Zen to look the same applying the same rules to the Drupal/Zen class name which already exist. Firebug is most useful. Read through one of the new books written about Drupal theming (Drupal 6 Themes or Front End Drupal http://drupal.org/books ) lots of good info in them.
I'll probably be starting with Zen from now on.

I would take Zen

marcvangend - June 9, 2009 - 21:05

I would take Zen, but to be honest, I think you should have asked this question before creating xhtml and css. IMHO, when you're developing with Drupal, it doesn't make sense to start with building xhtml/css/js. Myself, I usually build a fully functional site before I even enable the Zen theme. I explained why in this comment: http://drupal.org/node/456642#comment-1564728.

One thing you have to understand about Drupal theming, is that not all xhtml/css/js output is generated by the theme, because modules provide their own default output. The theme is able to override that output, but in many cases there is no reason to do that because the default output is usually valid, functional and flexible. If you want the final xhtml output to be 100% identical to the xhtml you created, you will have to override every single theme function and template... now that would be a waste of time. One way or the other, you will now have to merge your xhtml and css with Zen (or any other theme for that matter, but Zen is an excellent choice).

Drupal has ways of inserting functionality (ie. as tabs, messages, or stuff in the $closure variable) in the page that you might not be aware of. You are doing yourself a favor when you use a theme like Zen as starting point: In a Zen based theme, it's easy to cut out things you don't need, while in a theme-from-scratch, it's much harder to retrieve functionality that was omitted from the beginning.

I hope that helps.

Custom is cool, and so are starter themes :)

Keyz - June 9, 2009 - 22:18

I've gone every route possible in the past 2.x years haha :D

If you start from scratch (I wrote about the basic process), assuming you do include Every relevant PHP variable in your page.tpl.php (e.g. have a look at Zen or other starter themes, or this listing), then Drupal will still output the core styled version of everything. It may not look pretty, but it is all there. Once you see it on the page, you can use Firebug to find out what class or ID it has, then search in Zen or other starter themes to get some nice code to pull out for styling that (or if you're adept with CSS and prefer to do it custom, you can do it yourself). All the HTML is there on the rendered page, with classes/etc for you to look up. Most often if doing a theme from scratch I'll go the first route, finding what something is with Firebug, then getting CSS for that element from Zen or another theme. Sometimes the theme demands unique styling of things like the secondary tabs/menu, so I will do them from scratch.

When it comes down to it there's not "too" many elements you may prefer to copy like this - primarily things like secondary tabs (the ones you see when logged in), improved styling for the admin section and jQuery toggle fieldsets, etc. You should definitely be aware of how Drupal menus work (they are nested unordered lists, with classes dynamically added for active state, trail, etc). You might like to add the Menu Class module for more human-friendly classes on menu items. In any case you will have to be a little flexible with the final HTML and CSS (don't go overboard trying to force Drupal to use your precise original code... most of the time you "can", but really you should not). Drupal does have a touch of "div-itus" and adds extra classes a purist will probably not prefer, in order to make it easier for non-CSS-gurus to style, but if you can live with them, then life's easier :) If the theme is from a client and comes pre-coded, assuming the code is of good quality, I'd probably stick with adapting it rather than reworking it from a starter theme. If the code is lousy, then definitely toss it in favor of a good starter theme (it's much faster to adapt a starter theme to look like the old theme than it is to deal with a plethora of bad code and the issues it causes).

All that said... if you don't have good HTML and CSS ahead of time, then using a starter theme can be preferable in most cases. For my personal way of working, I like the Framework theme at the moment. I'm also looking into the Blueprint and 960 themes (which are for two of the main grid CSS frameworks). In every case though, there are a few gems from Zen that I adapt into any theme (e.g. excellent body classes in template.php). Especially if you're not an expert with cross-browser compatibility, most starter themes help you avoid the pitfalls of various browser issues. If you work as part of a team, it can also be great, since everyone gets used to the same theme framework and better understands how it works.

Hope this helps :)

...

Jeff Burnz - June 9, 2009 - 22:46

Bah humbug to these guys saying it doesnt make sense to start with HTML/CSS etc, these guys obviously do not work as professional themers, since thats how the rest of the world works, designers and theme developers do this all the time and thats what they send me to be ported to Drupal.

I much prefer the Genesis starter theme, or if I'm working with a grids design I'll use Ninesixty.

Its actaully really easy to port your design over - if your a gun with HTML/CSS then fire up up your theme in Firefox, and fire up your Drupal installation with a subtheme ready to burn. You've already written the CSS so thats a big advantage (we are just theming elements & selectors here, its all pretty much the same bar the switch in selector).

This is where Genesis has it over Zen in a big way, because Genesis defines the vast majority of selectors and elements in pre-built modular stylesheets, so they show in Firebug, so element for element you can easily see where you need to apply your existing styles. Just use firebug to look at your own stuff, then figure out which selector to use in Genesis using the inspect element tool in firebug. Zen defines a few selectors but no where near as many.

Take it from someone whose been porting themes from professional designers and every other conceivable CMS/website/what-ever for the last 3.5 years solid that porting your design to Drupal with Genesis is a breeze.

Genesis should give you an easier upgrade path to D7 also because all the body, node, comment and block classes are identical to Drupal 7.

All this said, dude, it really depends on your design as well, if your doing something way outside the norm then you may be better off using your own layout and inserting in the Drupal variables in the right place. So, it just depends.

Jeff, I can understand that

marcvangend - June 9, 2009 - 23:40

Jeff, I can understand that you (being a freelance themer) have to port html/css to a Drupal theme, but you seem to forget that some professionals work in companies... Where I work, we just changed the work flow, regardless of "how the rest of the world works".

...

Jeff Burnz - June 10, 2009 - 00:06

Big deal, good for you, but that sort of fighting talk is what is burying Drupal in last place of the theme world, what I hear is "change how you work to suit this particular CMS", well thats not how the vast majority of designers work, and Drupal should wake up and realize it.

Even within companies the workflow I use is quite normal, why, because the project could be using anything from Drupal to Django, from MT to Magento. For some projects it actually makes less sense to start out theming Drupal, when one part of the site could be Drupal and another a totally different system, but you want visual/design consistency across the entire site. Generic HTML comps, PSD's and a style guide etc for the various themers makes more sense.

Jeff, I never meant to speak

marcvangend - June 10, 2009 - 07:46

Jeff, I never meant to speak "fighting talk", but if that is how you perceive it, I apologize.

I'm not saying that your workflow is not normal. I'm not saying that the rest of the world should do as I do. I'm not even saying that different approaches are impossible. The author of the original post, suppose, was asking for opinions and experiences, so that's what I gave back: My opinion, speaking from my own experience.

I think we have to distinguish between the discussion about what Drupal is now and what we want Drupal to be. You are right that my comment says "change how you work to suit this particular CMS", because IMHO, that is the best approach to Drupal theming at this moment. In fact, I would love to start with html once in a while, but right now I don't consider that a good option. If that is indeed "burying Drupal in last place of the theme world", then that is a problem that we have to address. Meanwhile, I am glad that I have the freedom to adapt my workflow to the CMS I'm using, and I will not hesitate to tell people that it works for me.

...

Jeff Burnz - June 10, 2009 - 08:39

Well, make no apologies, I totally respect your position, and your work flow is what works for you and thats the most important thing.

Its just that I've been sitting here reading the same old "use Zen, learn Drupal" advice dolled out for years, and I haven't seen this create a profound paradigmatic change wrt to the number of designers both engaging and sticking around in our community, frankly I see more of them hot footing it out of here.

Sure, tell people what works for you, all I am saying is that when designers engage, ask questions before pounding out the "use Zen/you should work this way" rebuttal.

Read Keyz reply, its stacked with well reasoned advice.

My experience has been that

charlie1234 - June 17, 2009 - 02:44

My experience has been that it's more ideal to do your HTML/CSS before switching over to theme mode. If you use Zen or hack up something else, you'll end up putting stylesheets together with bubble gum and chicken wire instead of showing up prepared. It doesn't take more than a couple of hours to really turn a layout comp into 1 html file. Honestly, when I do this I include my styles right in the header. Why split them up when you're going to have CSS files next round anyway? It keeps your editing down to only 1 open file, and only 1 page to refresh 1,000 times in your browser. Once you've worked out the little kinks in your colors, styles, links, the line-height that looked great in Photoshop but doesn't look so good when Firefox renders it, etc., you'll be ready to pull out your Zen STARTERKIT (or whatever you want to use) and quickly turn your stuff around.

Personally, I have a copy of Drupal 6.12 with a sites/all/themes/customtheme/ folder that's ready to hack away at. This is the STARTERKIT converted and ready to work with. I include all of my basic modules that *every* client will need. I copy and paste this whole package into a new folder, rename it to their site name, and go to town. Additional modules can be added, among other things, but I've got this little Drupal folder that can be setup locally, the custom theme can be created, and the whole thing can be uploaded and online thereafter.

Anyways, my point was that it's better to do some styling firsthand, and then pull it into whatever template is most relevant to your project. 100% of the time that's Zen for me, since Zen's STARTERKIT isn't anything more than an empty theme with some CSS resets.

Boy, I'm a bona fide newbie

nwwoman - June 18, 2009 - 18:06

Boy, I'm a bona fide newbie when it comes to Drupal. I have, though, been building sites since 1993, yes, the start of the web days. So, html, xhtml, css, hand-coding, cgi perl scripts, dreamweaver.... you name it...that's easy for me.

Now how about converting an html/css to Drupal? I found that a snap, too. In fact, that's been the easiest step in Drupal for me -- and I don't know any coding of any sort. I didn't even use Zen or other "starter" packages. I found it really intuitive in 6x (which is where I started) to insert the php print variables and create regions using the info file. It's truly a snap. My site is complicated.... no "blog" look to this one.

You might want to go to mustardseedmedia.com He has a video podcast on how to convert a site from html/css to drupal. It's fast-paced, upbeat, easy to follow and simply good. I think if you view it, the lightbulb will snap right on. Try it!

Now the rest of Drupal? Egads. That's another story. I'm so stressed out. I'm doing Drupal every single day. But I don't know what I would do without this forum or the groups site for drupal. Thank heavens for the help! Back to my favorite spot: search.

Mustardseedmedia.com's Video ROCKS!

tofuComputer - October 20, 2009 - 00:32

Like many of you, I'm an experienced web designer/developer and know how to code just fine. But I'm new to Drupal (going on about 13 hours in use now lol). I love Drupal very, very much so far but...

Let's be honest. Trying to take your custom XHTML/CSS and making it "fit" into a pre-existing Drupal theme is just retarded. You need to learn how to make Drupal work with you, not how to make yourself work with Drupal.

After spending well over half the time I've been using Drupal for the past two days searching for how to integrate Drupal and my code, I found the video by Rob at http://www. Mustardseedmedia.com to be the best and most imformative of all so far! It's fast, makes sense and show's you how to utilize Drupal from the standpoint that you would approach most coding/CMS/CMF projects you do.

Check it out!

Hi Doug, welcome to the

marcvangend - October 20, 2009 - 05:51

Hi Doug, welcome to the community. Posting links is fine on this forum, don't worry about it (or was that space a typo?). Just to make sure: do you mean this video? http://mustardseedmedia.com/podcast/episode3

I nowadays also always start

andirez_ - July 3, 2009 - 11:29

I nowadays also always start from clean HTML/CSS and then "port" my theme to Drupal. I find it very easy to port my themes to Drupal, but I do have a fairly good knowledge of Drupal theming in general and thus I make sure that I use a semantic structure that is easy to use with Drupal. I often find the starter themes a bit overwhelming, but that is probably just me not putting enough effort into it.

Client-wise, this workflow also works better for me as a client will often ask for quick HTML mock-up, something I find much easier to do without having to drag Drupal along from the start.

Agreed that working out your

imp7 - July 4, 2009 - 05:05

Agreed that working out your ideal markup initially will save you time as working within tpl.php files you have to think about drupal too much.
I would rather work out what its going to look like in a few browsers first with some mock content, then when happy port it to drupal adding all the fabulous snippets from efforts like zen in your div classes and so on. During the porting you can use a very basic theme initially I like canvas in http://drupal.org/project/framework or even use the stylestripper module to get rid of potential css conflicts.

This is all based on experience and opinion however and you must find what you find works best for you.

...

Jeff Burnz - July 4, 2009 - 06:35

I tend to use whatever suits the project and mostly just end up porting what ever I am given as the resource to port - so that can be fully worked up HTML comps, PSD, PNG, Illustrator etc etc. This means I tend to sculpt the markup as I go along, which is pretty easy for me since I know Drupal *quite well* and I have a pretty big lib of functions & templates that help me do that. If I have a preferred way to work, its from fully worked up HTML comps, but I ignore the markup and merely emulate the layout et al with my own + Drupals.

I am a drupal newbie myself,

dopedwizard - October 20, 2009 - 12:24

I am a drupal newbie myself, tried to build a theme of zen with no luck. I could not get zen to do what I want it to do, and ended up creating my theme from scratch. So I would recommend to do it from scratch.

 
 

Drupal is a registered trademark of Dries Buytaert.