The code you wrote doesn't work because $node->content['rate_poll']['#value']
is only present when the node is being viewed. The code that adds $node->content['rate_poll']['#value']
is in the implementation of hook_nodeapi()
, and the code is executed when the operation is "view."
/**
* Implements hook_nodeapi().
*/
function rate_nodeapi(&$node, $op, $a3, $a4) {
// Adding the form to the node view
if ($op == 'view') {
$widgets = rate_get_active_widgets('node', $node->type, $a3);
foreach ($widgets as $widget_id => $widget) {
$widget_name = 'rate_' . $widget->name;
_rate_check_widget($widget);
$display_mode = $a3 ? $widget->teaser_display_mode : $widget->node_display_mode;
$widget_code = array(
'#value' => rate_generate_widget($widget_id, 'node', $node->nid, $display_mode),
'#weight' => $widget->node_display == RATE_DISPLAY_ABOVE_CONTENT ? 0 : 50,
);
if ($widget->node_display != RATE_DISPLAY_ABOVE_CONTENT && $widget->node_display != RATE_DISPLAY_BELOW_CONTENT) {
$node->$widget_name = $widget_code;
}
else {
$node->content[$widget_name] = $widget_code;
}
}
}
}
For the code to work, you should change it to the following one.
$node = node_load($row->nid);
node_invoke_nodeapi($node, 'view', FALSE, TRUE);
echo $node->content['rate_poll']['#value'];
echo $node->title;
node_invoke_nodeapi() invokes any implementation of hook_nodeapi()
, using its first parameter as operation value. Once the function returns, $node
will contain any $node->content
value added by the modules, including $node->content['rate_poll']['#value']
.