Inside Drupal

in

It's nice that Drupal comes with a few pre-defined themes, but one of my reasons for choosing this CMS was to have control myself over the look of the site. Having been recommended the Zen theme as a starting point, it's time to explore. Zen doesn't use tables and is minimal so you're free to do your own "CSS thing".

Watching pages load, Firefox is flicking away, why so many files? A glance at the source shows why:


<style type="text/css" media="all">@import "/modules/node/node.css";</style>
<style type="text/css" media="all">@import "/modules/poll/poll.css";</style>
<style type="text/css" media="all">@import "/modules/system/defaults.css";</style>
<style type="text/css" media="all">@import "/modules/system/system.css";</style>
<style type="text/css" media="all">@import "/modules/user/user.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/mine/style.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/html-elements.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/tabs.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/mine/layout.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/mine/mine.css";</style>
<style type="text/css" media="all">@import "/sites/default/themes/zen/block-editing.css";</style>

What a lot of stylesheets. It seems strange to me that drupal.org has advice about writing themes and modules, but as yet I've not found anything that answers questions like "When a page request arrives, which files are executed, what PHP functions call what, what's the path through the code?".

When a request arrives for www.example.com/node/123 or www.example.com/some-page, the web server doesn't find such a location within the filesystem. This causes a '404 error', a missing page error, and the .htaccess file is examined to decide what to do.
ErrorDocument 404 /index.php

So index.php is entered. Putting into Google Drupal internals, the first hit is http://drupal.org/node/26040 and reading BlueDrupal's concerns it's clear I'm not the only one frustrated by the lack of a good description. That page was written in 2005 about Drupal 4.6, so a few things are out of date (drupaldocs.org is now api.drupal.org, some of the line numbers don't match, snippets of code are a little different). But it's still worth reading, and really needs someone who knows what's what to pull out the useful bits into something coherent.

Let's hope eventually I have time and patience to find out more, in which case I'll add to this page.