[development] proposal for theming nodes

Syscrusher scott at 4th.com
Wed Dec 14 21:00:12 UTC 2005

On Wednesday 14 December 2005 12:38, Darrel O'Pry wrote:
> I'm in full agreement. posted the same thing on the theme list.
> I think node->extra is probably a better name than the node->html i
> suggested, but still a little too abstract. Maybe node->rendered since
> we are talking about themed output whether its html, xhtml, rss, atom,
> or whatever.

What about three arrays:

   $node->before[] and $node->after[], to tell the themer that the
   added content is logically before or after the node body

   $node->extra[], to add content that has no specific sequential relation
   to the node

Note that this is *not* intended to imply any particular placement on the
page, but rather a relationship to the node having to do with the order
in which the user should see the content. How the theme places it could
be left-to-right (or the reverse, for some languages), top-to-bottom, on
a diagonal, or ... whatever. In many themes, this may imply order of HTML
emitted, but in other themes, it may relate to prominence (size and/or
decoration) rather than strictly sequence.

The behavior would be that each module can optionally add pre-themed
content to $node->before[$module_name] (and so on), and the page theme
would then insert the concatenation of these arrays in a place of its

The before, after, and extra semantic is advisory to theme developers, not
binding upon them. Default themes could take the simple course and simply
prepend and append before[] and after[], respectively, and put extra[] in
some reasonable place (maybe between the node body and after[]).


Scott Courtney     Drupal user name: "syscrusher"   http://drupal.org/user/9184
scott at 4th dot com       Drupal projects: http://drupal.org/project/user/9184
Sandbox:  http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher

More information about the development mailing list