Syndicate

Feed

Packt Publishing Drupal 5 Themes reviewed

A first release candidate of Drupal 6 was made available on December 20, 2007, that is, two days prior to the publication of this theming guide... which covers Drupal 5! Drupal 6.1 has since been released, and many of Drupal’s most popular add-on modules are now ready for use on production web sites. The author mentioned on his blog that an updated version of his book will be published, but Packt Publishing is not yet listing 'Drupal 6 Themes' among its upcoming publications. Still, I read the book, and worked through its examples on a Drupal 6 install. As a somewhat seasoned Drupal developer, I still found the book helpful. I recommend it, provided that, as you read along, you refer yourself to the concise (and well-put-together) Drupal 6 theming guide available on Drupal.org. Theming has definitely taken a leap forward in D6. For instance, intercepting and overriding theming functions is a lot easier now.

I bookmarked quite a few pages in the book Drupal 5 Themes.


What this book covers

Chapter 1 ("The Elements of a Drupal Theme") presents the theming terminology used in Drupal — and that stuff hasn’t changed in Drupal 6.

Chapter 2 explains how to set up and configure a theme in Drupal in the admin interface. By way of example, we download the theme 'Gagarin' from Drupal.org and install it. We also configure 'Garland', which still is the default theme shipped with Drupal. Surprisingly, I learned quite a handful of tricks in this chapter. All of it is applicable to Drupal 6; even the neat PHP snippets used for the content & visibility of custom 'blocks' work as is. For fun, I ported the Gagarin theme to Drupal 6 in less than 10 minutes, using a porting guide put together by Wesley Tanaka. Your milage may vary (you may do it faster than I).

Chapter 3 explains how the PHPTemplate 'engine' works. Wordy as this chapter is, the definition of a theming engine remains... somewhat ambiguous. But the rest of the book will clear that out. You may download this chapter from the publisher’s web site. Take note that the default PHPTemplate 'template' files have been moved to their respective core module folder in Drupal 6. For example, you’ll find the default page.tpl.php file under /modules/system, and node.tpl.php under modules/node.

Chapter 4 is a reference guide to stylesheets and themable (ie: overridable) functions. Only a brief description (ie: one sentence) is provided for each function. The author gives us a snippet of PHP code that produces a list of the theming functions used on the page, but it’s somewhat useless because with it we don’t know which function produces what markup. In Drupal 6, a neat & sexy add-on module, 'Theme developer', part of the 'Devel' kit of modules, tells us which function to override — and so much more: using Firebug-style point-and-click, we can select the DOM element we wish to theme, and we learn how to do so (that is, which theming function to intercept & override) by reading a tooltip. See the screenshot and screencast.

Chapter 5 presents different ways to intercept & override themable functions. In Drupal 6, one of these ways has been simplified, that of "placing overrides in dedicated [template] files" for which no default file exists. One needs to tell the theming engine about the presence of the template file by way of a preprocess function, setting either $vars['template_file'] or $vars['template_files']. In the instance where we want additional variables to become available inside the template, we use that same preprocess function, ie: engineName_preprocess_hook.

In Drupal 6, adding stylesheets (besides the default style.css) is as easy as adding a few lines to a new *.info file for the theme. Same with creating new regions on the page: the themeName.info file takes care of that. One needs not add any PHP code to template.php.

In chapter 6, we modify a theme, 'Zen'. Be warned: even the Drupal 5 version of this theme has undergone significant change between the time that chapter was written and the publication of the book.

In chapter 7, we learn how to create a theme from scratch — and so much more (this chapter definitely should have been broken down). We’re finally presented with a list of the variables available in each template file. In Drupal 6, many variables have been renamed (for example, $sidebar_left has become… $left), and new handy ones have been created which are available in all templates, for exampe $logged_in and $is_admin. Note that we should use the new D6 variable $body_classes to apply dynamic CSS styling, instead of the ol’ $layout (still available).

In chapter 8, we learn how to theme forms. I had to do some research to find how to apply the author’s solutions within Drupal 6. Some change is trivial, for example the handy hook_ form_alter function has different parameters passed to it in D6, the function’s signature has changed...

From that in D5 : function formmod_form_alter($form_id, &$form){

To this in D6 : function formmod_form_alter(&$form, $form_state, $form_id){

In D6, some form-theming solutions are easier to implement... or more difficult: I still haven’t figured how to use images for the forms submit button. However, to achieve this, imo, a CSS solution is preferred in both Drupal 5 and 6. No need to change the markup. (Use the CSS property background-image in other words, and 'indent' the submit button text far-far to the left.)


What this book does not cover, though I wish it did

  • How to use jquery, the wondrous javascript library shipped with Drupal (there is no mention of it, really).
  • How to create a theme with a configurable color scheme, using the Color Module. A simple tutorial where we create a theme for which we can change the color of the header and links through the 'setttings' UI would have been awesome. By the way, it was brought to my attention that a patch is available to make the theme 'Bluemarine' (shipped with Drupal 6) colorable.
  • Related to the last point, we’re not shown how to modify the theme’s settings page — to add to it, for example.
  • How to theme Views pages, and nodes created with the Content Construction Kit (CCK). Although it becomes easy to figure it out. To theme a view, we need to know the 'internal path' of the view, and create a template file for it. For example, if the internal path is 'view/comments', then the template file to drop in our theme folder would be page-view-comments.tpl.php. (By the way, the explanation for the order of precedence among template files, ie: the working of the variable $suggestions, has moved to /includes/theme.inc. in Drupal 6.) When it comes to theming a node with a particular node type, we need to know the machine-readable name of the content type. Hence, to theme nodes created with CCK that are of the type 'news', we drop a template with name node-news.tpl.php in our theme folder.
  • How to commit a theme to Drupal.org CVS (using a freeware utility like TortoiseCVS, for example).

This book is particulary successful at breaking down information into bits and steps. It is extremely well-written, quite technical and in-depth, and provides a handful of screen captures in most places. Lists of To-Do’s, in the form of "client’s requirements", make it all the more fun to work through the longer exercises. Finally, we can theme it _all_ in Drupal, and the author drives that point home.


Where the book falls somewhat short in its delivery

  • Although the author comes from a "design background" (so it says in the book’s preface), he fails to inspire. The theme created from scratch is particularly unappealing. Check it out:
  • Bluewater, a theme created from scratch

  • When it comes to designing Drupal themes, in chapters 6 and 7, we’re faced with basically copying and pasting CSS rules scattered throughout a set of *.txt source files (that you can download from the publisher’s web site) into one stylesheet, ie: style.css.

Although, to be fair, this is not a book on CSS, nor web design...

Last edited by Caroline Schnapp about 8 years ago.

Comments

Very detailed review.

Very detailed review. Thanks.

Very helpful review

I have read a number of reviews of this book, but yours is easily the most helpful. I like the way that you have inserted lots of links to other sources of information (especially re Drupal 6). I will actually bookmark this review just for this collection of links. I think one thing you have highlighted is that there is lots of room for more to be written on Drupal themeing.
Thanks!

Your work is very good and I

Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us.
Latest Melbourne Cup Results

Honestly, I was actually

Honestly, I was actually looking at this at the book store but i was not able to find it. hmm I don't know if it's already available here. montreal web design company

Honestly, I was actually

Honestly, I was actually looking at this at the book store but i was not able to find it. hmm I don't know if it's already available here. montreal web design company

Im no expert, but I believe

Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that.
jouer au keno

Chapter 4 is a reference

Chapter 4 is a reference guide to stylesheets and themable (ie: overridable) functions. Only a brief description (ie: one sentence) is provided http://e-papierossy.com.pl/en/e-papierosy/94-e-papierosy-gambit-9812.html for each function. The author gives us a snippet of PHP code that produces a list of the theming functions used on the page, but it’s somewhat useless because http://e-papierossy.com.pl/en/e-papierosy/95-e-papierosy-gambit-5412.html with it we don’t know which function produces what markup. In Drupal 6, a neat & sexy add-on module, 'Theme developer', part of the 'Devel' kit of modules, tells us which function to override — and so much more: using Firebug-style point-and-click, we can select the DOM element we wish to theme, and we learn how to do so (that is, which theming function to intercept & override) by reading a tooltip. See the screenshot and screencast.

My thoughts on the book

I just bought this book and didn't find it that useful. Granted it has given me a more clearer vision on how theming in Drupal works, I find that it falls half flat since it does not cover Views/CCK/Panels.

Just 2 weeks ago, I gave Drupal another shot after couple of years running DotNetNuke. I'd have to say that with a very vague knowledge of PHP, I was overwhelmed by the CMS.. Literally spent days on end going through the guides on the Drupal site itself, and the end result was that it really didn't bring me up to speed with everything. Hence, the search for books.

The one thing I find with learning is, that books provide a progressive way of learning that supercedes many resources online. With this sentiment, I took my time and subscribed to Peachpit Safari and bought the "PHP6 & MySQL5" book from Larry Ullman and a couple others and ultimately read over about 800+ pages of his books to grasp PHP a bit better. After this, I purchased Drupal 5 themes and finally understand theme function overrides! I had some huge troubles going through the Zen part of the book and was disappointed it hadn't used one of the newer revisions of the theme, but oh well. I've yet to go any further in the book, but can foresee myself disappointed in the fact that, as mentioned above, Views/CCK/Panels was not discussed at all. If anything, they are assets to theming and should not be left out.

I'm grateful at least it has given me some slight perspective on the in's and out's of Drupal and the foundation that governs the entire system though.. Without it, all the documentation on the Drupal site would be utterly useless for me. Even now, I'm still flabbergasted by many of the doc's on it. While I don't have a programming background, I've done my rounds with PHP and as an independent designer and also previously from school.

My conclusion is that the book just left me bitter. I will definitely go about finishing it up, but I suppose I was expecting more.. Much more. These pail in comparison to the quality of the Visual QuickPro Guides published by Peachpit Press. I just wish they'd go about covering Drupal someday now..

Will post back with results on my success.

P.S. Might I add you have TONS of amazing documentation on this site.

Wonderful review!

This is one of the most thoughtful book reviews I've ever read in my entire life.

Thanks for sharing your insights!

I do have my own review which can be found here.

Happy Theming!

Marc Robinsone

p.s. I wish Micheal C. Hall is a Drupal themer

ah ah ah

p.s. I wish Micheal C. Hall is a Drupal themer

Me toooo.

Thank you for posting a link to your review. I had not come across it yet. I encourage everyone who reads *this* to go read Marc's review. By the way I agree with everything you say there... it makes me want to modify my own review, to add to it...

Have a splendid day, Marc!

Dexter?

I hope to read more reviews from you in the future!

I'm waiting for Packt Pub's next Drupal 6 book to arrive at the my doorstep.

A splendid day to you too!

Hoping to get a peer review,

Marc

p.s. If Mr. Hall sees this post I'll run and hide!

Dexter

I'm waiting for Packt Pub's next Drupal 6 book to arrive at the my doorstep.

Me too. :-)

Review

Very detailed and well tought review of this book. Thanks for porting this good info here.

great

actually, I am a new to drupal and i am not yet great with it that is why I am still looking for the best one. sell electrical surplus

I had a tough time learning

I had a tough time learning Drupal when I first started using it, especially after using an extremely simple CMS like wordpress where you could just go find a theme you wanted without understanding much code. I ended up buying this book and it made a HUGE difference in my level of understanding. I'm still not a Drupal pro, but I'm certainly much better than where I started.

amazing screen notion

Even like this could be a amazing screen notion. It may be fairly engaging indeed. Thank you for your facts. I definitely like to research details.

Somehow this is a really

Somehow this is a really good strategy and we should do it. I am sure that we iwll have excellent results.

great

Now I do love this drupal themes books here. Well, in my situation I think I should buy more drupal tutorial books or even ebooks that I could use for my own resources. montreal web design

I do agree with melanie that

I do agree with melanie that somehow for us the beginners, we could use some of these books and ebooks that we bought online. I don't have drupal projects yet but will be having just like this. bookkeeping websites

I have an interest in that

I have an interest in that book but my problem is they have available book but not like yours. So maybe i should find it in other store. In your statement it is really great one i have some learning's in that one. Not just learning it is made me also clearer vision now and i guess it is better to buy that book.

I am sure that this could be

I am sure that this could be a big help for all of us the drupal users. This is also going to help those beginners or just started to learn drupal. electrical surplus buyers

The website is looking bit

The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface. http://www.videopokerenligne.net/

Can you post some

Can you post some interesting tutorial here about the Drupal 5 theme. project management pdu

So kind of you

It truly is very much exciting to me to write down some of my own trial and error ideals with regards to some of my own online favored best writing service review which can be loved online in particular by means of my own facebook web page. No. connected with readers are generally incorporating day by day. Appreciate it for your form assist.

Interesting, my opinion is

You know, some pictures of some of the themes would have helped. Was disappointed when I didn't see them. Anyway, Drupal is an excellent content management system, although it's not widely known. Personally, I think WordPress have already sewn up the market, as it makes life easier for those interesting in setting up a website quickly, though Drupal will always be in and around.