[development] proposal for theming nodes

Nedjo Rogers nedjo at islandnet.com
Wed Dec 14 16:20:52 UTC 2005

Good thinking, Ber.

> I think this practice of appending stuff to the body is very bad, since it
> makes it impossible to add thatdata elsewhere, without duplication.

Agreed.  We end up appending to $node->body in e.g. 'view' nodeapi hooks 
($node->body .= $whatever), or prepending, simply because there's no other 
way to get additional content rendered by themes' _node() functions--short 
of editing an individual theme.  The result is a lump of undifferentiated 
content, that the theme can only blindly repeat.

Consider the case of an image that's meant to accompany a node.  What we 
really want to do is define something like a $node->thumbnail_image, that 
the theme can then decide how to render.  But if we do so the theme won't 
know about this newly-defined property of the node object, so no image will 

> I think that teh best option is an additional variable in $node
> $node->extra
> containing structured data added by all the modules.
> $node->extra->upload could, for example contain that uplaod/attachement 
> table,
> that is now hardcoded to the body.

So I like this idea a lot.

And, if for example we required that all $extra content be valid XHTML, 
e.g., be contained in an enclosing tag, we could include logic in the 
theme-side parsing that defined different handling for different types of 
tags.  I.e., theme parses first tag name, and, e.g., if it's an img, 
encloses it in a div with a particular style to define its placement on the 

More information about the development mailing list