If you take a look at node_show in node.module, you see we check if comment_render exists. This seems kind of like a backstep into the way Drupal is designed. Drupal is designed to build upon nodes in a modular form. Having the node system check if other modules are implemented means that it isn't taking advantage of its own design. This is a major flaw and leads to so many problems when we want to theme the nodes (comment_render is called automatically for every node). This should be fixed....
/**
* Generate a page displaying a single node, along with its comments.
*/
function node_show($node, $cid, $message = FALSE) {
if ($message) {
drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))));
}
$output = node_view($node, FALSE, TRUE);
// EVERY NODE CALLING comment_render?!
if (function_exists('comment_render') && $node->comment) {
$output .= comment_render($node, $cid);
}
// Update the history table, stating that this user viewed this node.
node_tag_new($node->nid);
return $output;
}
Instead, the call to comment_render should be moved into comment_nodeapi($op = 'view'), so that it would use the node system to render the comments. Comments should build upon the node system, instead of having the node system implement the comments itself. It seems there are a lot of checks to module_exists('comment') in node.module.... This is a horrible design flaw.
Comments
Comment #1
robloachMoving to Drupal 7.... This is just way too big an issue to push into Drupal 6.
Comment #2
catchSubscribing to this although I think there's another issue trying to separate out comment_render. Similar deal with node_comment_statistics here.
Comment #3
catchHere's the node/comment rendering issue fwiw: http://drupal.org/node/134478
Comment #4
liam mcdermott commentedSubscribing. :)
Comment #5
bjaspan commentedI am inclined to declare this issue as a duplicate of http://drupal.org/node/134478 which, although it did not start out there, is now firmly focused on this precise issue. Thoughts?
Comment #6
catchYeah it's a duplicate. Shame to see such a great title go to waste though :(