Live, Learn, Complain

July 19th, 2007  |  Published in etc  |  4 Comments

That illustration encapsulates this post nicely, so stop there if you’ve got the gist.

I went with Joomla for a project on a few of its strengths: Fine-grained content control, a very active developer community that cranks out lots of decent third-party extensions, and a fairly sophisticated community of template developers who make some decent designs.

It’s not without its flaws. I used to complain bitterly about StoryServer from the user interface side, but Joomla has a few baroque conventions of its own. They seem to be there because some developers, instead of making a good interface, made an interface they thought would be good for users who were exactly like themselves, only total cretins.

Anyhow, I looked around the backend, did a few tests with it, decided I could impose it on someone else in good conscience, and grabbed a template for the project.

The commercial Joomla template authors are generally down with the whole CSS-driven layout thing, so it’s easy to find something usable with reasonable modification terms that’s forward-thinking. If you paw through the template code, you won’t see anything objectionable. I went that direction because I didn’t want to deal with learning Joomla’s templating system right away. So I found a good template with the right general layout and look for the project and set to work on refining the style sheets. That’s when I learned Joomla’s unhappy secret:

Underneath all the templates and stylesheets, there’s one file driving the pages, and it’s a giant mish-mash of tables. Further, most of the modules you encounter tend to produce tables as their output. You can refine the output on modules to strip out the table code and just wrap stuff in divs, but for the main content loop you get tables, and there’s no way around that in the software.

It gets kind of ridiculous, too. The core logic has every single element on a page getting tucked into its own row or cell. When that’s stuck on top of the templating code itself, it’s a cluttered, opaque read. And the HTML it outputs is ungainly and sloppy. The tables severely limit your ability to control vertical space, you have to hack the core files to do some perfectly sensible things (like put your byline, dateline and section on the same line instead of spreading them over three), and little of the output below the table level is assigned a class.

People have hacked up the core Joomla files to get rid of the tabular layout, but the hacks are imperfect because they don’t take into account the column options Joomla provides. So if you want multi-column layout, you’re either going to be hacking someone else’s hack or live with tables until Joomla 1.5 comes out, which is supposed to address a lot of this.

There’s also an after-market in modules and add-ons designed to get around the woefully inflexible layout. Some of them are good (and cost plenty), some of them are awful and demonstrate that it’s possible to spend your days digging a tunnel from a dungeon and into a sewer.

I’m living with it for now, myself. It makes a lot more sense to insert a few easily documented classes into the rat’s nest of tables Joomla spits out so I can get slightly better control of the presentation and sweat/change less when patches come out.

It’s a good object lesson, though, in why tables suck for layout. Any residual “I’m gonna smash the evil tables coz ALA told me to” lemmingism has been burned away in the purifying fire of realizing that tables are just a pain in the ass to deal with. Any fragility one might claim about CSS-driven layout is offset by how hard it is to get good control over table-based design — especially if it was written by someone else and without an eye to making the design part of the job easier.

In the interests of helping anyone who comes through here at some point in the future, here are some things I learned that may work for someone else coming to grips with Joomla’s unfortunate guts:

  • Later versions have introduced a workaround to the core /components/com_content/content.html.php file. Just make a directory called “components” under the top of your template directory and copy the file into that. It replaces the original file from the Joomla core on page render. You can hack it up with impunity and not worry about misplacing the path back to factory defaults. I’d like it if the template designers crowing about their “100 percent CSS layout!!11!!!” would take advantage of that and deliver on their claim 100%.

  • This doesn’t help the main loop, but you can get modules to render without table code using switches in the templates:

    • -1 will remove all the surrounding code

    • -2 will wrap the output in .moduletable and put the title in an h3 tag

    • -3 will wrap the output in three layers of divs and put the title in an h3 tag

  • Here’s an example of a tableless joomla hack. (And note that registration is required to get at the files everyone says they’re posting.) If you want to hack that hack to get something like a leading article back into the design, look at the file content.php around line 1247. I never got my use of that hack past the “looks o.k. on my Mac browsers” stage, and never worked on styling the output.

  • http://www.scarletstarstudios.com/ gl.

    thank you. i’ve always wanted to be attracted to joomla (i have a dream), but it never appealed to me, and now i have a good reason to ignore it. :)

  • mph

    Not knowing what your dream is, I don’t know if I’d feel good about encouraging you to ignore Joomla. :-)

    It really can look nice despite the horrible guts, but the thing to keep in mind is that you have to be pretty sold on whatever design template you decide to go with. If you have any second thoughts about any positional issue you detect in the template, proceed with caution. Or, I guess, if you just don’t want to represent yourself with table-based layout. Once that decision’s made, though, you aren’t ever brought face to face with the underlying engine.

    In terms of the CMS angle, it’s better for sites for which you mean to have lots of content. The kind of thing where the WordPress “you get an interface for editing pages” paradigm breaks down, and where MovableType is plainly inappropriate. I’ve seen “make WordPress a CMS” tutorials, but it seems like that’d be for something on the border between “small site with a collection of static articles that could use a pretty interface for management” and “hand-coded 10-page brochure site.” I’d never inflict Joomla on a small business, unless that business wanted to publish lots of articles as part of a broader promotional strategy.

    All the same, I think I’ll keep Joomla in my toolkit, especially since I’ve learned a lot about it in the past month thanks to trying to overcome that core engine issue. But this experience has convinced me that I need to look into Drupal and a few other points along the CMS continuum as it points toward “simple” more closely.

    And I left this out of the main post, but Joomla’s WYSIWYG editor reinforced my hatred of that kind of tool. Laggy, broke my browser’s cursor movement keybindings, and the underlying code it spits out is sometimes nested in arbitrary divs and needless linebreaks. I was happy to rediscover its off-switch.

  • http://www.ubuntuSC.com antonio

    Ive used Joomla on a few sites, your right, as with all things it has inherent flaws BUT if you can workaround,work with, ignore, or fix these flaws to your liking it is much better than wordpress as a CMS or IMHO mambo!

    So as with all things open source it takes some tweaking BUT the benefits out way the inconveniences.

  • http://www.encke.net Flynn

    Watch out for [url=http://www.postnuke.com/]PostNuke[/url]. The first Release Candidate for PostNuke 0.8 is out and it is exactly what you were looking for in Joomla.

    greetings

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.