PHP to retrieve nid's of all children?
Jboo - May 1, 2009 - 11:44
| Project: | Node Relativity |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Hi,
I'm trying to put together some code that will add together all of the children on a parent node. I have this code so far:
<?php
$design = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'design', 'function' => 'average'));
$performance = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'performance', 'function' => 'average'));
$current_rating = ($design[0]['value'] + $performance[0]['value'] + $value[0]['value']) / 2;
print '<div class="fivestar-rating">'. theme('fivestar_static', $current_rating, '10') .'</div>';
?>The problem is it only retrieves the nid of the last submitted child, whereas I need it to basically total up each child nid. So (although I'm clueless with PHP), in simple terms instead of $node->nid I'd need to be $node->41 + $node->47 + $node->65 (obviously this isn't right, but I just wanted to explain what I'm trying to do...basically retrieves all child node ID's and add them together in the code above.
If anyone can point out how to do this I'd really appreciate it.
