[development] proposal for theming nodes

Jose A. Reyero jareyero at wanadoo.es
Wed Dec 14 16:28:41 UTC 2005


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.
>
>  
>
Yep, I agree, same problem here

>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.
>
>
>  
>
First I would like to insist in that *all html* produced should be
themeable.

About this specific issue, I think we could
a) Just use themeable functions, that can be overridden, like a
'theme_upload_node_body' but, anyway, don't store it into node->body,
but in node->output or similar
b) Use that $node->extra->upload you propose but maybe better make it an
array, $node->extra['upload'] so we can use a simple 'implode' at the
end. Maybe weights could be useful here too

The ideal would be using both, themeable functions that produce
structured data, but any of them used separately would just fix the
problem. However, the way to go, thinking big, would be kind of
'generalized form API' that could be useful to build any object -page,
block, node..- as structured data and then render it to HTML.

>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)
>  
>



More information about the development mailing list