I have a Contemplate template for a node type which loads another node object, and then the template displays bits and pieces from each node to form a whole page.
Background info (not pertinent, but gives you an idea of what/why I am doing this), I have a CCK node type for lawyer biographies, and a CCK node type for law firms. There is a Many-to-One relationship between the Lawyers and the Firms (many lawyers can belong to one firm, but one lawyer cannot belong to many firms). The tie-in between lawyers and Firms is based on a Taxonomy vocabulary using Territories...
So in the Contemplate for the Lawyer Bio, I have the following code to add the Firm node object:
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$nid = (int)arg(1);
$terms = taxonomy_node_get_terms($nid);
foreach ($terms as $term)
{
$term_id .= $term->tid . ",";
}
// print $term_id;
$term_id = rtrim($term_id,',');
$listlength="1";
$content_type = 'content_ela_member_firm_profile';
$result1 = pager_query("SELECT DISTINCT (n.nid), n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type = '$content_type' AND tn.tid in ($term_id) AND n.status = 1 ORDER BY n.created DESC", $listlength);
while ($firm_node = db_fetch_object($result1)) {
$firm_object = node_load(array('nid' => $firm_node->nid));
}
print_r(get_object_vars($firm_object)); // This is temporary, to show me all the object properties I can access & use
}
php
This gives me access to the Firm node object & properties just fine. But, the object doesn't have any of the ['view'] properties that I'm used to working with in a Contemplate template. I also tried $firm_object = node_view(node_load(array('nid' => $firm_node->nid)), 1); but that doesn't return an object, just a fully formed HTML node...
I'm wondering where/how/what I can do to get a node object with all of the ['view'] properties? Is this function part of Contemplate or Drupal's API ??? (basically, it's because I'm lazy in outputting/constructing the HTML for some images and what not... the ['view'] property has img links formatted all nicely with the alt and title info, otherwise I have to build it manually with theme_image(), etc. )
thanks,
-Chris