Hi,
I am trying to construct my own modules out of the node_example module. I want to be able to upload a couple of images together with this some other info.
I pasted all what seemed to be the necessary fuctions from the image.module. Everything works fine up to when it comes to showing the actual images. I think my error must be somewhere in the hook_load(). The original node_example loads data and returns it whereas the image.module loads defines in $node an image array. this works fine but when it comes to showing the images in hook_view() the images array is not defined.
Is there a way to return the image array together with the $additions in one object or alternatively what is going wrong that $node->images i undefined?
<?php
function node_example_load($node) {
// pasted from image.module
$result = db_query("SELECT filename, filepath FROM {files} WHERE nid=%d", $node->nid);
$node->images = array();
while ($file = db_fetch_object($result)) {
$node->images[$file->filename] = $file->filepath;
}
// special images
if (empty($node->images['thumbnail'])) {
$node->images['thumbnail'] = $node->images['_original'];
}
if (empty($node->images['preview'])) {
$node->images['preview'] = $node->images['_original'];
}
// node example module way of doing things
$additions = db_fetch_object(db_query('SELECT URLpath, URLpath2, quantity FROM {node_example} WHERE nid = %d', $node->nid));