[development] Building $node->body with arrays like FAPI for viewing

Rob Barreca rob at electronicinsight.com
Fri Jul 14 17:44:12 UTC 2006


>
> Are you aware of the fact that $node is available with all its metadata, like 
> $node->content_driving_directions (when using CCK)?
> And that PHPtemplate offers these as variables: $content_driving_directions 
> wehn using CCK.
This is much better than simply appending to the node body, I agree. But 
when using other contrib modules with CCK, one must still either choose 
$content OR manually construct the body and no $content.  Something like 
form_render() would be awesome too -- allowing you to pull a section out 
of the body but still use body_render() (a.k.a. $content). I know there 
are weights in CCK, but for the sake of example:

<?php print body_render($node, 'content_driving_directions'); ?>
<?php print body_render(); ?>
> Doing a $node->body = theme('image_build_body', $node); (note the missing . 
> dot! I create a whole new body in that theme function), i am doing a better 
> job.
I agree on that one. Especially for a short term solution. But, 
reorganizing additions to the node->body still is a pain as we basically 
still only have the choice to prepend, append, or do nothing at all. The 
content is still being constructed textually before & after this point.

> Fapi is causing enough pain as it is, IMO. No need for more of em in core. ;)
I only say FAPI so people know what I mean about building arrays.  IMO 
this /could/ be a very simple solution. ;) Basically, saving the 
ordering, building of the node body until the last second to allow for 
modifications.

I know it may seem overkill since I'm drawing parallels to FAPI, but it 
would be very light. Let's call it NAPI (or FAPI Lite) from now on. :-P

Rob Roy Barreca
Electronic Insight Corporation
12526 High Bluff Drive, Suite 300
San Diego, CA 92130
http://www.electronicinsight.com
rob at electronicinsight.com



Bèr Kessels wrote:
> Are you aware of the fact that $node is available with all its metadata, like 
> $node->content_driving_directions (when using CCK)?
> And that PHPtemplate offers these as variables: $content_driving_directions 
> wehn using CCK.
>
> IMO, it is far ùmore rewarding to make these modules that append 
> $node->body .= jst like that,smarter.
>
> If I *only* $node->body .= '<div>' . $image .'</div>'; then I have created a 
> badly designed module.
>
> Doing a $node->body = theme('image_build_body', $node); (note the missing . 
> dot! I create a whole new body in that theme function), i am doing a better 
> job.
>
> But if in addition I present a $node->image =$image_file_obj; You, as themer 
> have all the power. No hierarchival-fapi-like Array will help me any more. 
>
> Summary: Let us find the contribs that are badly coded and improve these. But 
> let's please stop this overengineering fapi-array-complexity-drive. :)
>
> Fapi is causing enough pain as it is, IMO. No need for more of em in core. ;)
>
> Bèr
>   


More information about the development mailing list