Reputation: 10881
I'm doing the following to load and render a node via ajax:
$node = node_load($id);
$node_view = node_view($node);
drupal_render($node_view);
This works perfectly for displaying the node, BUT the comments and comment form are missing. How would I add the comments and comment form to either $node or $node_view so they are rendered by drupal_render? node.tpl.php is being called to render the node FYI ;)
Thanks!!!
Upvotes: 0
Views: 5792
Reputation: 36957
Looking at the comment module (specifically comment_node_view()
) it should be added by default but if not this should work:
$node = node_load($id);
$node_view = node_view($node);
$node_view['comments'] = comment_node_page_additions($node);
echo drupal_render($node_view);
Upvotes: 6