The Contemplate module (or Content Templates module) is a bless when you want to give a certain node type a specific layout. It’s easier than using node-type.tpl.php from an administrative point of view because you don’t need to upload new css-files, and from a designing point of view because the module provides a convenient list of available variables.
What wasn’t immediately clear to me, however, was how to include the commenting section in a node using Contemplate (or node-type.tpl.php for that matter). A search on drupal.org eventually leaded me to using this:
if (function_exists(‘comment_render’) && user_access(‘post comments’)) {
print “<div class=’cscomment’>”;
print “<h3 class=’field-label’>Comments</h3>”;
print comment_render($node);
$node->comment = NULL;
print “</div>”;
}?>
which works fine at the moment.
Note that this is working for Drupal 5, but in the same thread, solutions for Drupal 6 have been suggested.

0 Responses to “Drupal: Invoke comments using contemplate”