About the Drupal theme

Anderson Lizardo lizardo at linuxfromscratch.org
Fri Jan 23 12:48:33 PST 2004


As you may know, we are working on a CMS that will replace our current 
website. Currently, we are evaluating Drupal, that can be accessed at 

I was, on the last two weeks, working on integration of the PHPTAL theme 
system with Drupal. I must confess it is not being an easy task, specially 
because Drupal works with the idea of "splitted themes" i.e. it expects that 
each theme has a "header", a "body" (splitted in even more modules) and a 
"footer". This way, Drupal calls the theme_header() function to get only the 
header portion, theme_footer() to get the footer, and so fourth.

A TAL template is essentially a well-formed XML file with special namespaces. 
XML does not allow you to have only a header, because it will have unclosed 
tags (like <html> and <body>) and thus will not be well-formed. Most XML 
parsers (including that used by PHPTAL) do not work with "broken" XML, only 
if each part is well-formed by itself.

Fortunately, Drupal is progressively changing the theme_{header,footer}() 
functions into a single theme_page() function, which will be compatible with 
theme systems that require well-formed XML templates. But, currently, this 
migration is not yet complete, and is only on CVS.

So, I suggest we start doing the LFS template based on the XTemplate engine. 
I'm almost sure I can circumvent the problems described above, but I'm afraid 
it will require even more time and I'm not willing to delay yet more our CMS 
evaluations. And, who knows, we can discover Drupal is not suitable for us...

Jeroen, I've created a template called "LFS" that you can freely modify to 
assemble the LFS theme for Drupal. The files which need modification are 
located at /home/httpd/test.linuxfromscratch.org/themes/lfs (generally, you 
will only need to modify the lfs.{css,xtmpl} files). You will see that the 
XTemplate syntax is easy to understand, but if you have any question, don't 
hesitate to ask :). If you feel that you need to modify some file outside the 
theme dir (possibly some hard-coded HTML), please let me know what changes 
you've made so I can report it to the drupal developers as it's possibly a 
bug (Drupal's theme system must be flexible enough to not require any change 
to the core PHP code).

And lastly, sorry for taking so much time to recognize that I was delaying our 
CMS evaluation :-/

Anderson Lizardo
lizardo at linuxfromscratch.org

More information about the website mailing list