[development] proposal for theming nodes

andre mcsparkerton at yahoo.co.uk
Wed Dec 14 16:53:48 UTC 2005

How about forcing module developers to only append themed content to 
nodes during a hook_nodeapi view call.

Problem solved.

function mymodule_nodeapi(args){

case 'view':
   $stuff = get_stuff();
   $stuff_i_want_in_node = theme('mymodule_theme_function', $stuff);

   $node->body .= $stuff_i_want_in_node;

Then the theme developer can override whatever is appended/prepended to 
the node.


Bèr Kessels wrote:
> Hi,
> way too often i have to hack modules or even core (upload) to make it *not* 
> append HTML to $node->body.
> I think this practice of appending stuff to the body is very bad, since it 
> makes it impossible to add thatdata elsewhere, without duplication.
> 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.
> In the very very end, the theme_node will iterate over all these ->extra 's 
> and append them to teh body.
> Now, the code, the patch, should not be too hard to make, its just a few lines 
> to the theme_node functions
> The hard part, imho is to convert **all** core modules to use this. and with 
> All i mean all :). Taxononomy, for example, should add its terms in there, 
> while book module should add its navigation. 
> The other thing is, that while this annoys me a huge lot, i just don't have 
> time to get a patch going, untill at least end of Januari. 
> Waht do others think
> Bèr
> PS: Im not to sure about tis crossposting thing, but there are loads of theme 
> and developers issues; is it safe to assume that interested parties at least 
> read development? (so that we can keep this on development)

Yahoo! Exclusive Xmas Game, help Santa with his celebrity party - http://santas-christmas-party.yahoo.net/

More information about the development mailing list