[development] proposal for theming nodes
Darrel O'Pry
dopry at thing.net
Wed Dec 14 17:46:03 UTC 2005
On Wed, 2005-12-14 at 12:27 -0500, Khalid B wrote:
> 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;
> > }
foreach ($node->extra as $key => $value) {
if(is_array($value)) {
$output .= join("\n",$value);
}
else {
$output .= $value;
}
}
More information about the development
mailing list