Hi

First of all, I'm a Drupal newbie - but I already can appreciate its unparalleled flexibility and functionality. Using the great handbooks at Drupal.org I've been able to achieve almost everything I wanted to do in my theme, however there is one thing I just can't wrap my head around. Namely - comment form display. I've got a faint idea of how to modify the form's content (custom module + Form API) - which is far too complicated as for theming needs by the way - but there's another thing: how, oh, how can I change the form's placement? I've been searching handbooks and the very forum, but to no avail.

As far as I understand it, by default the form is a part of $content variable, which is available in the node.tpl.php. But let's suppose I don't want the comment form right beneath my post (I'm putting together a blog). I want it in a sidebar or the footer. How can I make it happen? Is there any way to do it without messing with the /modules/comment/comment.module file? Hopefully, there is, otherwise this is a great flaw of the theming system.

Looking forward to any pointers. Thanks!

Comments

pwolanin’s picture

The comment form seems to be added at the end of the thread in this function: http://api.drupal.org/api/HEAD/function/comment_render

I think the comment module is not really using appropriately the new node rendering mechanism with structured content.

This is where the above function is called: http://api.drupal.org/api/HEAD/function/node_show

It's worth looking in the patch queue to see if anyone has classified this as a bug yet.

However, one thing you could do is to put a comment form elsewhere using:

comment_form_box(array('nid' => $nid), t('Post new comment')); 

OR

drupal_get_form('comment_form', array('nid' => $nid), t('Post new comment'));

This would probably work best if you disable the display of the comment form on the same page as the node.

see: http://api.drupal.org/api/HEAD/function/comment_form_box

---
Work: BioRAFT

Helldesigner’s picture

Hi pwolanin

Thanks for the quick reply. Had some problems with the code initially (it was rendering
's action param without node's ID - so I couldn't really post any comments with such a form), but as soon as I changed

array('nid' => $nid)

to this:

array('nid' => $node->nid)

it worked like a charm :) Thanks a lot!

Best
Kamil