[development] D6 Adding an image to a node for viewing

Carl Wiedemann carl.wiedemann at gmail.com
Tue Feb 1 07:39:28 UTC 2011

On the secondary node, try implementing node_build_content(), which should
provide to you the secondary $node->content array, or I think you might get
this by calling node_invoke_nodeapi($node, 'view', $teaser, $page) directly.
See the internals of node_build_content()

Keep in mind this *will* invoke hook_nodeapi($op = 'view') for the secondary
node, which will call your hook_nodeapi() *again,* so make sure you aren't
doing anything redundant or getting stuck with infinite recursion somehow.

On Mon, Jan 31, 2011 at 10:50 PM, <jeff at ayendesigns.com> wrote:

>  I'm hooking nodeapi op=view and I have the node I hook and another in the
> db. The one I hook has field_image which, when hooked, is [0]=>NULL
>  I load a node from the db, which also has an image field (both are CCK
> imagefields). I want to add its image to the original node, however, I need
> at this point not to add it to field_image, but to
> $node->content->field_image. The problem is that the structure of ->content
> is pretty convoluted, ending ultimately in data that is the same as what
> I've copied (when I look at a node with an image), but I can't seem to cause
> that to happen. I tried adding the image structure from the source node
> directly:
> $node->content->{$field_name}['field']['items'][$key]['#item'] =
> $image_structure;
>  but that seems to cause more convolution rather than ending up like the
> $node->content structure from the source node when I display it.
> --
> Ayen Designs
> 388 Bullsboro Drive #105 · Newnan, Georgia 30263
>  404-271-9734
> Web:ayendesigns.com
> Blog: theAccidentalCoder.com <http://theaccidentalcoder.com>
> Drupal: j. ayen green <http://drupal.org/user/367108>
> IRQ: j_ayen_green
> IM (Yahoo) baalwww    (MSN) baalwww at yahoo.com
> Skype: ayendesigns
> Ayen Designs is a tradename of the computer services division of
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110201/4ae3218a/attachment-0001.html 

More information about the development mailing list