... and so on.
We currently have a very fuzzy "tree" that builds our site. I doubt anyone has ever traced the route a string takes from within some Drupal-module 'till its printed.
Some theme functions call other theme functions, whom call other theme functions. Sometimes inbetween you find that Drupal APIs are called.
theme_some_hierarchy() {
$hierarchy = build_hierarchy()
foreach ($hierarchy as $subtree) {
theme('hierarchy_part', $hierarchy, $subtree);
}
}
Freely crafted after our menu building systems, and just an example.
Recently Dries said he disliked theme functions calling theme functions. This is done all over the place. Maybe we need to look at a solution for this? Something to either get a very consistent page building mechanism (brickslate is an idea to do this after the way JS builds the DOM) . Maybe we need to only create a conceptual guideline. And maybe we need not worry at all and continue trialling-erroring our way to our Perfect Designs.
What do you think?

Comments
brickslate, htmlareas & contentregions
I don't know how to say it in another way but the main "problems" I have with phpTemplate is, that it is in some parts very detailed (search_box, search_url, search_button_text, search_description), but there is none for the meta-title or pager.
I think the brickslate-idea is a well idea to bring structure into html source. I would really like to make this to a main discussion for "DrupalCon Brussels".
"Calling theme functions which are calling theme functions" is a typical way of Drupal, which seems sometimes to be a distributed system wherever it's possible ;)
Once upon a time I thought about a system like:
sitemeta
title
keywords[]
description
(...)
body
common
title
message
slogan
navigation
links[][] /* Primary, Secondary, ... */
But this was faster said than coded ;)
But I strongly agree to Bèr that this is one of the most important improvements Drupal would need. This would help to build well designed usable (WCAG, Section508) sites, too.
Names!
http://groups.drupal.org/node/892#comment-2451 is a first post about a theme that does all what you ask above and more. whatsinitsname
»» code (alpha) here http://cvs.drupal.org/viewcvs/drupal/contributions/themes/whatsinitsname/
»» example here: http://vabusiness.us/ Heavy under developement, so expect non-working weirdnesses.
Please read the f** source of the example: isn't that clean or what!? ;) look at the CSS: less then 200 lines to get all the shadows, rounded corners, shaded tabs etc. Its all about naming the classes and IDs. Really! http://vabusiness.us/
http://www.webschuur.com | http://bler.webschuur.com
Nesting theme functions
Speaking a somewhat novice themer and module coder, do we have any viable alternative within the current system?
If theme functions shouldn't call other theme functions, doesn't that mean large monolithic theme functions that require large chunks of code to override? Taken to its logical extreme, wouldn't it mean there was only one theme function per 'page' type in Drupal? When I'm overriding theme functions in a theme, I like lots of small focussed functions vs a few big ones. Big ones just increase the amount of code that has been duplicated and diverged from the original code. Most theme overrides are only very small changes after all.
That just seems like stating the obvious though. Maybe we are just overreacting to the original objection?
Brickslate sounds intriging even if I don't fully grok it fully yet :)
--
Cheers
Anton