Breaking

Followers

Friday, 16 June 2017

Attaching the comment form programmatically


Most of the time, Drupal's convention of printing comments and the comment form inside the node template (node.tpl.php) is desirable, and doesn't cause any headaches.


However, I've had a few cases where I wanted to either put comments and the comment form in another place on the page, and in the most recent case, I asked around to see what people recommended for moving comments out of the normal rendering method. 

if (!empty($node->nid)) {
    $comment = comment_node_page_additions($node);
    print render($comment); 
 }
               
           

No comments:

Post a Comment