I have created a custom block module that will display the children of a taxonomy term and if a term has no children it will display the nodes of that taxonomy in a table. The node type that they are showing were created using CCK and contain an image field and I would like to display the contents of the image field in this table.
So far I have only figured out how to be able to display the name of the node with a link and the time/date the node was last updated, but have not been able to figure out how an image might also be displayed. Could anyone offer advice about how to do this or point me to some documentation on the topic? Everything I found suggested that I should use CCK but for this particular problem I think I need to create my block programmatically.
EDIT:
function children_view_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'children':
$path = explode('/', drupal_get_path_alias($_GET['q']));
$tid = array_pop($path);
$term = taxonomy_term_load($tid);
// Set up the table rows and headers array
$rows = array();
$children = taxonomy_get_children($term->tid, $term->vid);
$title = "Child Name";
$header = array($title, 'Updated');
// Add a new row for each child term
foreach ($children as $child) {
$rows[] = array(
l($child->name, "taxonomy/term/$child->tid"),
$child->vid
);
}
// Set up the params for the theme_table call
$table = array('rows' => $rows, 'header' => $header, 'empty' => 'No terms found');
//$block['subject'] = t('');
$block['content'] = theme('table', $table);
break;
}
return $block;
}