Slashdot Mirror


Front End Drupal

Michael J. Ross writes "Content management systems (CMSs) are created largely by Web developers using back-end programming languages (such as PHP, by far the most common choice). The free CMSs are built as open source projects, by volunteers who have many demands on their time. As a result of both of these competing factors, far less time is devoted to the front-end aspects of these CMSs. In turn, the "themes" that define the appearance of a CMS-based website are typically substandard, in the eyes of many Web designers and, most likely, countless users of those sites. This criticism has been leveled even against Drupal, although the situation is improving. A new book, Front End Drupal: Designing, Theming, Scripting, is intended to help Drupal designers everywhere speed up that process of improvement." Read on for the rest of Michael's review. Front End Drupal: Designing, Theming, Scripting author Emma Jane Hogbin and Konstantin Kafer pages 456 publisher Prentice Hall rating 8/10 reviewer Michael J. Ross ISBN 978-0137136698 summary A comprehensive guide to creating Drupal themes. The book was written by Emma Jane Hogbin and Konstantin Käfer, and published by Prentice Hall on 15 April 2009, under the ISBN 978-0137136698. As suggested by its title, Front End Drupal "is designed to help both experienced designers and rank novices get an understanding of how Drupal theming works," to quote from the book's foreword, written by Dries Buytaert, Drupal's founder and project lead. He notes that creating a Drupal theme requires knowledge of "XHTML, CSS, JavaScript, and PHP, all within the context of Drupal." These are some of the key technologies addressed in the book's eleven chapters, and it assumes that the reader is at least familiar with all four of them. The first of the two appendices explains: how to install Drupal and contributed modules on the three different platforms supported (Windows, Linux, and Mac OS X); basic configuration and administration; and installation troubleshooting tips. The second appendix comprises some of the more important example code used in the book, and brief overviews thereof. At the end of the book's 456 pages, there is a coupon code for a 45-day free subscription to read the online edition in the Safari Books Online library

All of the sample source code and themes can be downloaded from the authors' book website. The site also has the author biographies, as well as reported errata, of which there are two, as of this writing. What is most striking about the site is its styling — or lack thereof. One would think that the authors of a book on Drupal theming would have put a commensurate amount of effort into crafting an attractive custom theme for their own website — one that demonstrates their own theming skills and, more importantly to the reader, what is possible using the principles taught in the book. Remarkably, the authors appear to have done nothing more than take the Drupal 6 default theme, Garland, and change the color scheme from shades of blue to shades of brown (matching the book cover); only the blue Drupal icon is unchanged, and its color clashes with the rest of the site.

Prentice Hall makes available their own Web page for the book, where visitors will find a description, two Amazon.com reviews, the table of contents, and a sample chapter ("The Drupal Page") as a PDF file. The entire book is also available in electronic form.

In the book's preface, the authors briefly summarize the chapters and appendices, and define the target audience and technologies with which the reader should be knowledgeable (noted above). Readers should also be familiar with how Drupal works, have some experience administering a Drupal site, and ideally possess some knowledge of website design and development; but that last one is not a hard requirement, since the authors promise to explain the basic concepts as needed.

Any reader who begins the book by skimming the table of contents or the preface's summary of Chapter 1, may be tempted to skip that chapter, especially since it discusses team workflow — something freelancers generally ignore, and employees leave to management. Yet the earlier material is worth reading, if only that it begins to establish a baseline of terminology used throughout the rest of the book. It also provides some basic information on content structure, layout, and naming on a Drupal page. For illustrating the ideas under discussion, the authors use a number of existing websites. In fact, too many different sites: Readers probably would have found it more useful for each idea to be presented in the context of a single neutral subject area, and without distractions such as toilet birthdays (no kidding). Even better, the ideas could have been illustrated through example pages — each page illustrating one or several ideas — built from the ground up. By focusing on pages that a reader could quickly create on his own, the authors could have eliminated the screenshots of those various websites. One example is Figure 1.1, which combines two images, with the topmost one largely obscuring the one below. Most of the topics are covered at a very high level — possibly higher in some cases than readers will find valuable. Nonetheless, there is much solid advice, including some recommended theme resources later in the chapter. In the earlier section on "Topical Organization," there is a brief but excellent discussion on the relative merits of limited versus unlimited tag vocabularies.

The second chapter continues to lay the groundwork, by introducing basic Drupal theme strategies and terminology, three major modules that veteran Drupal developers use frequently (CCK, Views, and Devel), and some valuable browser-based development tools. The definitions of Drupal terms are useful — especially for newbies confused by the Drupal handbooks. One exception is the authors' alternative metaphor for "weight," which proves more confusing than the original. Readers then begin learning how to use the aforesaid modules and tools. However, several of the authors' statements are misleading: On page 43, they are instructed to install the CCK module, and then given a list of additional modules needed; the first one on the list is... CCK. On the next page, the authors state that the FileField module requires the Token module, but it apparently does not. On the page after that, the "manage fields" link is given as the "add field" link. Those last two discrepancies suggest that the book is based on outdated versions of Drupal and/or the contributed modules under discussion, even though its publication date is just a few weeks prior to this writing. Any version differences are likely impossible to confirm, since the authors fail to mention which versions they are using, or provide any guidance to the reader as to which versions to use — unusual for a programming book. At the beginning of the chapter, the reader is told he "will learn step-by-step how to create a mini portfolio Web site," but the process peters out not long after a new content type is created, and the reader finishes the chapter with no such portfolio site.

Chapters 3 and 4 move the reader one step closer toward the ultimate goal of being able to create a new theme with confidence. The first one explains how to find, install, and configure prebuilt themes — also, how to create a very basic theme from scratch, and a subtheme using the Zen starter theme. This material comprises a generally thorough introduction to the topics, compared to most documentation, with plenty of step-by-step explanation. An exception is the Zen section, in which the reader is instructed to place the directory into the themes folder; but it is not made clear whether this is the primary Drupal themes folder, or sites/all/themes (as advised several pages earlier). Secondly, in step 3, readers can only guess as to what is meant by "the main CSS file," as there are several. On the next page, the authors mention "configure" links next to the Zen and Zen Classic themes, but no such links exist for those starter themes. The fourth chapter discusses page template files, site-wide variables, menus and navigation, regions and blocks, search results, templating different sections of a site, aliased URLs, taxonomy templates, and styling for output to printers, PDF files, and mobile devices.

The fifth chapter explores the details of how to modify existing node templates, or create new ones, for all content types. This is what makes it possible to develop highly customized page content, including summaries, embedded images, image galleries, and content based upon output from the Views module. The subsequent chapter focuses on one of the most problematic types of content — forms — and how they can be created using the CCK. The authors recommend TinyMCE as one's WYSIWYG editor module, but that has apparently been replaced by the Wysiwyg API. User editing of content is a key element in building an online community using a Drupal-based site, and it is the topic of Chapter 7, which discusses user profiles, permissions, access, comments, blogs, forums, wikis, spam, CAPTCHAs, and how to make content private for members only. The next chapter addresses the theming of the administrative interface, which the typical site user will never see, but can have a significant impact upon the productivity of the developers and maintainers of a site. Readers learn about RootCandy (a refreshingly different admin theme), and how to theme error pages.

The final three chapters focus on JavaScript and jQuery. Consequently, they compose a stand-alone resource of their own, and could even have been used as the basis for a separate book. Chapter 9 provides an overview of the language, while the other two chapters cover jQuery and how it can be used as part of a Drupal-based site.

Scattered throughout the manuscript are tips, each indicated with a pencil tip icon. These help to break up the text visually, and provide valuable guidance. The contrast between the black text and the dark gray background could certainly be improved; but most of the tips are fairly short, so this does not pose a major problem.

Every chapter ends with a summary, and not a single one of them is useful or needed. Any unique information conveyed in them should have been merged with the introductory paragraphs for the respective chapters, which is where readers would be looking anyway to see what each chapter addresses.

The book has numerous minor problems, including grammatical and stylistic errors, such as dashes incorrectly performing the duty of semicolons, some URLs missing the root directory slash, and excessive use of exclamation marks (more than a dozen before even reaching the second chapter). When stating the sequence of menu items to choose in order to reach a particular admin page, the authors should use ">" or ">>" to separate the menu choices, as is done in most computer books. Instead, the authors opted to use commas, which of course turns every sequential menu path into a list of menu items, which is nonstandard and disconcerting. As is typical in a first edition, the book contains several errata: "Partnership" in Figure 1.7 (page 10), "the GiMP" (page 14; should simply read "GIMP"; after all, this isn't Pulp Fiction), "only focus only" (page 26), "Modification / Date" in Figure 2.1 (page 37; should read "Modification date"), "Content Creation Kit" (throughout the book; should read "Content Construction Kit"), "of [the] view" (page 56), "http:jigsaw" (page 66), "INSTALL [is] present" (page 79), "of [a] page" (page 100), and "to to" (page 125) — in the first quarter of the book alone.

A lingering disappointment is that some of the promised examples are not finished in the narrative, such as the portfolio site mentioned earlier. Secondly, the downloadable source code is incomplete, apparently missing the example code in the first few chapters, such as the Bolg theme files. Furthermore, the downloadable code is not organized by chapter, making it difficult to even determine what example code is missing.

On the other hand, the book has much to offer. For the most part, the explanations and step-by-step instructions are clear, and the diagrams and screenshots are all neatly presented and helpful — though some sections of the book could have benefited from more such figures. With its extensive coverage of all the key technologies, and its wealth of valuable tips, Front End Drupal is an essential resource for learning how to create Drupal themes, and fills a long-standing gap in the Drupal literature, better than any other book currently available.

Michael J. Ross is a freelance Web developer and writer.

You can purchase Front End Drupal: Designing, Theming, Scripting from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

16 of 68 comments (clear)

  1. At first I thought it said the end by diskofish · · Score: 3, Insightful

    and I said "Good Riddance". Drupal is powerful, but not really that fun to develop with.

  2. Content management without content by shoppa · · Score: 3, Funny

    What's most intriguing, is that 90% of the sites fronted by content management systems actually have no content!

    1. Re:Content management without content by operator_error · · Score: 4, Funny

      You mean like Slashdot?

  3. I thought Drupal was a... by GottliebPins · · Score: 2, Funny

    female impersonator? Or was he that libertarian that ran for president?

  4. Tired of crappy CMS' by Anonymous Coward · · Score: 4, Interesting

    I'm so tired of taking over sites where the former "developer" used a Drupal or Joomla installation.

    It is inevitable that the requirements of a custom web app will eventually exceed the capability of these systems. Knowledge of a particular CMS does not a developer make! These are tools in a toolbox and should be used as such. I hate it when people sell themselves as freelance "programmers", but really they only know how to use a particular CMS. So lets write a book and encourage this behavior - bluagh..

    --that's my 2 cents, but then again, I'm just an anonymous coward :-)

    1. Re:Tired of crappy CMS' by revjtanton · · Score: 5, Insightful

      I installed a Joomla site for a latino non-profit in Baltimore who's previous site was a mess. It was a mess because my "predecessor" threw a bunch of random things together (directory using a database and articles in plain html only) and those who run the charity don't know anything about web design at all. I came in and installed Joomla and designed a few things to work in that installation because it is easy for someone to use AFTER I step away.

      If your argument is that Joomla and Drupal have no place because web apps will outpace their development then why is the Joomla extension repository so extensive and growing? For every new app or site that comes along someone will develop a module or plugin for the CMS's because a CMS is easier to handle for a business that doesn't conduct even 50% of it's business online and so there will be a market for easy to use plugins.

      If your main argument is your other one: freelancers who install a CMS and call themselves programmers are frauds then I can't really argue with you. For someone to call themselves a developer or programmer simply because they've installed a CMS is silly, but there are plenty of us who are programmers of one type or another that still use a CMS because there is no need to completely redesign the wheel every year. I'm all for people learning to write code, but if everyone wrote code then my abilities would be worthless...

      All I'm saying is that the capability threshold of any CMS is irrelevant in terms of web applications because anything can be branded obsolete by anything else at any time (see Wolfram|Alpha vs. Google); and while installing or administrating a CMS doesn't make you a developer on its own, plenty of us developers give a CMS it's value and that's what this book is pointing out!

    2. Re:Tired of crappy CMS' by hobo+sapiens · · Score: 3, Insightful

      Ah the ever popular Request for Citation, the easy but ultimately ineffective method of deflecting anecdote.

      What, do you expect someone to have some case study that considers which percentage of all websites ever created outgrow their CMS? Argh, as if! Anecdote is the best you'll get in this type of discussion. Guess what? IT pros get paid based on their knowledge of anecdote; it's called experience.

      I agree with OP. Many of these CMS have fairly limited use cases. As soon as you outgrow that you have to hack its core, which often produces less-then-stellar results. Then you have to learn the (in the case of Drupal) byzantine and poorly documented API.

      Use Drupal if you want a blog or some kind of a news site where content is published for people to read and comment on. If you want something more, then creating software to fit your need IS NOT reinventing the wheel. It's building for your particular use case. Don't use a hammer when you need a sawzall.

      If you want a skyscraper you wouldn't make the mistake of piling prefab houses on top of one another to reach the desired height (after all, the walls are built! Why, it'd be reinventing the wheel to build walls!) If you want an eCommerce site or some other relatively complex or specialized app, then don't make the mistake using an overgrown blog site. The time you save doing things that *are* wheel reinvention (authentication, user profile, other plumbing functions) will be lost when you need to kludge something together to stay withing the framework and still fit your needs, and then have to support said kludge.

      --
      blah blah blah
  5. The community isn't really vibrant. by haeger · · Score: 3, Interesting

    Looking for answers or reporting bugs is somewhat unsatisfying in drupal. To be honest not really drupal but the modules but since they're actually what makes sites useful. Bugs and supportrequests go unanswered for months unfortunatly.
    I love drupal and use it for my own site but finding support is quite hard. Usually it means going into irc and bothering people there which is a bit sad since most answers aren't searchable later. Yes I do try to add the answers I get to drupal.org in case you were wondering.

    Ok, so this wasn't exactly on topic but hey, not many drupal stories show up on slashdot so I thought I'd grab the chance to whine a little.

    --
    You are not entitled to your opinion. You are entitled to your informed opinion. -- Harlan Ellison
    1. Re:The community isn't really vibrant. by drinkypoo · · Score: 3, Informative

      I've found that if you're using more or less mainstream modules, there's plenty of activity. If you're off on the fringes, be prepared to fix problems yourself.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  6. Drupal cannot currently be taken seriously by message144 · · Score: 5, Informative

    I have been developing for Drupal for 5 years, with a portfolio of many large scale projects. I am also the author of some popular Drupal modules.

    With all that said, in my experience, Drupal offers zero TCO or ETA advantage over Django or Symfony on any medium to large project. A lot of the great things you may hear about Drupal are coming from either (a) Non-developers or (b) People who have staked their careers on Drupal.

    A few reasons why Drupal cannot be taken seriously include...

    1) Lack of unified model layer and no ORM. The recent efforts to implement schema definitions are still, unfortunately terrible. All content types should be able to be defined as a model, including CCK fields.

    2) Over-reliance on Views and CCK modules. These are just fancy interfaces for a model layer. They are great for non-developers, but in no way compare to a proper model implementation. At the end of the day, you will save zero time by implementing a Drupal View over implementing a simple ORM call. Views and CCK slows down development.

    3) Lack of any solid deployment procedures. Ever tried merging changes between different Drupal configurations?

    4) Using native PHP as the templating language. This causes more headaches than one you can possibly believe. A proper templating language should be used instead which will prevent lazy or incompetant developers from adding business logic into templates.

    5) An army of incompetant, unexperienced developers contributing sub-par modules.

    6) Lack of any kind of namespacing whatsoever. "De-Facto Namespacing" is a pile of shit.

    1. Re:Drupal cannot currently be taken seriously by timothyf · · Score: 3, Interesting

      I won't comment on the ORM, Views and CCK stuff beyond agreeing that it could be a lot better (though what we have now is much better than where we were). I'm not sure what would constitute solid deployment procedures for you, so without an example I can't comment.

      4) Using native PHP as the templating language. This causes more headaches than one you can possibly believe. A proper templating language should be used instead which will prevent lazy or incompetant developers from adding business logic into templates.

      I can't say that I agree with you on that--most of the template engines I've seen end up replicating a high percentage of core PHP--but in any case, it's a problem that has been fixed already by theme engines. Don't like phptemplate? Use Smarty: http://drupal.org/project/smarty or develop your own theme engine.

      5) An army of incompetant, unexperienced developers contributing sub-par modules.

      I would say that's not so much the problem as that there isn't a good way to separate the wheat from the chaff currently, though it sounds like that's in the works for the next iteration of drupal.org.

      6) Lack of any kind of namespacing whatsoever. "De-Facto Namespacing" is a pile of shit.

      Heh. Agreed, though I think that this is somewhat a function of the lack of namespacing in PHP influencing the design.

    2. Re:Drupal cannot currently be taken seriously by Anonymous+Brave+Guy · · Score: 3, Insightful

      Would you be willing to elaborate a little on your concerns, please?

      Some colleagues and I are about to start a major overhaul of a moderately large site (a few dozen pages, a few thousand users, a few hundred visitors per day). It seems like the first choice is basically between "standard framework with some plug-in custom features" (CMSes like Drupal) and "custom architecture with some standard plug-in features" (using things like Django and some common libraries).

      So far, we've been forming the opposite view to you: a lot of the site we'll be producing is static content, but a few parts will require moderately structured data (the equivalent of a few tables and some simple SQL queries), and for that balance Drupal seems like the best tool we've considered so far. We don't have much experience with these particular tools, but the guys building the system will be proper designers/developers, while the guys maintaining some of the content will be entirely non-technical. Is our situation just different to what you're describing, or are there really a bunch of problems waiting for us a little way down the line?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    3. Re:Drupal cannot currently be taken seriously by yareckon · · Score: 2, Interesting

      I disagree about the importance of many of your points in the grand scheme of things (when considered against the benefits of a very capable core platform with literally thousands of plugins).

      However, some of what you say is important, is widely acknowledged, and is being actively worked on. Deployment and change management for content and configurations in particular has been a weak point of drupal to this point, but there are now several major projects underway that attack this from different angles. I think the tools will get dramatically better in the next year if the presentations at drupalcon DC 2009 were any indication.

      Also, I think your overall approach to web development is way over on the cathedral side (which may be because of your focus on the needs of large projects, granted). Drupal's community ecosystem flourishes on building on other folks's work. The hook system, allowing modules to exchange events and pass control back and forth, performs the same function in code. It's a very bazaar model once you get out into the contrib repository. You will need to wade into the community to get the most out of drupal, IMHO.

  7. heh... by Gabbermatt · · Score: 2, Funny

    And here I thought this was going to be a book about what happens to women when they grow older...

  8. CMSes and my opinion by Vamman · · Score: 5, Interesting

    Let me take a step backwards for a second and explain my situation. I've been developing for the web for many years now and I've seen technology come and go but I've never seen an idea of an OpenSource web portal take such a strong hold as Joomla! has. PHPNuke was close but even then you rarely randomly stumbled upon a Nuke site every second search. However, unlike Nuke, Joomla seems to have taken over like a bad storm.

    I still have some websites lingering around that use Joomla but I am very much dissociated with that CMS, infact any CMS nowadays. I find the issues that these systems bring to the table far outweigh any little added productivity that a small group can sustain. There are teams of script kiddies from Asia and elsewhere scouring online websites for these systems to prove just how easy they are to hack into. If you have an online database with confidential client information, you are in trouble.

    The largest website I manage is my own and it ran Joomla for 2 years while I was working on my MSc degree. I had to deal with repeated attempts by hackers to break into this website. It was very frustrating after scouring logs on my linux server to find out that they came in through one of the "secured" CMSs. SQL injections, cross site scripting hacks, upload/media vulnerabilities, you pretty much name it that so called secure web server had one big gaping hole in it and that was Joomla.

    I peruse Joomlancers sometimes when looking for some spare cash (freelancing site dedicated to Joomla) and try to encourage local North American companies to ditch this disaster of a CMS. Not only do you have to deal with bugs and exploits at the core but when people load up this CMS with extensions that are mostly all crap (even Community Builder can't seem to get it right) you put together a nice looking template (like this guy with his book from Drupal suggests) and then put it out there for the "Mad Dogs of Vietnam" to hack into and make your online reputation look like shit.

    I salute the chap that pointed out how vastly the Joomla community is growing with its extensions and micro-economic community, its a good point really. But if you take a look at whose running these communities (Joomla Art, a popular Joomla template company, Joomlancers, and others) are all owned by a Vietnam company that has less than stellar ethics when dealing with clients - Just search the Joomla forums. I have to wonder why the top contributors and hackers are all from the same city Hai Noi =) Birds of a feather I suppose or is that just job "security"?

    I got out as fast as I got into looking after websites running Joomla. Last year we had 13 clients running Joomla and what a headache I developed looking after these sites. The previous freelancers knew how to use a CMS and after that they knew nothing. Even their half-assed attempts at building in additional functionality was more of a joke than anything. I had clients breathing down my neck over issues that were really out of my control. One day I woke up and realized that the real issue was Joomla and thats when I drew the line with it. Now a days I only work for clients that will develop from the ground up. I no longer have to deal with the types of security issues that these open CMS systems bring to the table. They are great to impress a client in a hurry with something that looks and works right away but as the days turn into months you will have the gut feeling like "what did I do..." ...don't do it. Build yourself a core set of functions and your own library in PHP and then build ontop of that individual sites. Code Ignitor among others still get a thumbs up from me. Don't use the same mysql fields all the time. Change your database connection strings up. Change critical global variables every now and then. Thats my 2 cents.

  9. 2 more cents on the open source CMSes of today by room34 · · Score: 2, Insightful

    As someone who has been developing custom CMSes at various jobs for over a decade, I've gotten to know what makes a CMS work (or not) quite well, and I've given most of the popular PHP-based open source CMSes (especially Drupal, Joomla, and MODx) more than a fair chance to impress me.

    So far, I always eventually get frustrated with their arcane and idiosyncratic ways of doing things, which often require as much new specialized knowledge as learning a programming language in itself, and in the end they're never quite the right tool for the job anyway.

    Now that I've been freelancing full-time for a year, I've come to a decision I'm satisfied with: as far as I'm concerned, there's only one pre-built CMS I've never been disappointed by, and believe it or not it's WordPress. But WordPress of course is not ideal for every site (it IS, however, ideal for lots of small- to medium-sized sites, not just blogs). Concurrently I've been developing my own custom CMS on CakePHP, tailored to the specific needs of my clients, and expanded as necessary as I've been adding more clients who are using it.

    So, what it boils down to for me is this: assess the client's requirements, determine whether or not WordPress fits the bill, and either go with WP or use my own proprietary CakePHP-based CMS, expanding it as needed.

    Maybe if one of the "big" open source CMSes were built on one of the equally "big" open source MVC frameworks, it would be worth investing the effort into getting to know inside and out, but just as I've made the decision to focus on PHP as my development language of choice, I've also had to decide to focus on one framework (CakePHP) and one CMS (my own) to know intimately and be able to build upon as needed.

    It's not so much a matter of "staking my career" on it as it is of focusing on my strengths and building upon them. The whole point of freelancing is to get more bang for my buck in terms of productivity (and income) per hour worked. And so far, Drupal, Joomla, MODx, whatever... they just don't fit into that model for me.