[development] proposal for theming nodes

Khalid B kb at 2bits.com
Wed Dec 14 17:27:15 UTC 2005


Andre, your solution is close to an ideal one, but still stuffers from
body being appended to.

I am not an expert in this area, but the idea is to provide both:

1. Discrete elements from modules as part of a node (this is the
"extra" elements)

2. Ability to display them anywhere on the page (via theme_*() function).

Perhaps ...

function mymodule_nodeapi(&$node, ... args){

switch($op){
 case 'view':
    $stuff = get_stuff();
    $node->extra['mymodule']['element'] =
theme('mymodule_theme_function', $stuff);

    break;
 }
}

The issue here is this is still missing a default way to display those
extra things,
and requires a custom addition to a theme.

Someone else may think of a way to tie those two concepts.

On 12/14/05, andre <mcsparkerton at yahoo.co.uk> wrote:
> How about forcing module developers to only append themed content to
> nodes during a hook_nodeapi view call.
>
> Problem solved.
>
> function mymodule_nodeapi(args){
>
> switch($op){
> case 'view':
>    $stuff = get_stuff();
>    $stuff_i_want_in_node = theme('mymodule_theme_function', $stuff);
>
>    $node->body .= $stuff_i_want_in_node;
>    break;
> }
> }
>
>
> Then the theme developer can override whatever is appended/prepended to
> the node.
>
> andre


More information about the development mailing list