Attached you'll find a small patch which introduces a new node-settings to switch the inclusion of comments off or on. If you turn off the switch, you'll have to load the comments explicitly via comment_render().

The patch should apply against drupal-HEAD.

I am a bit unsure about my solution, ideally there should be no comment-related code in node.module, and the setting should reside under admin/comments/configuration.

I am in the need to split comments from the node-output, so I can display the comments where I want.

What do you think?

CommentFileSizeAuthor
node_module_patch999 bytesstmh

Comments

markus_petrux’s picture

Maybe you could do what you need using the Views module?

stmh’s picture

I didn't try the views.module, and perhaps it is a suitable solution to get a list of comments, but this does not resolve the output of comments as part of the node_show-method e.g. when viewing a particular node.

moshe weitzman’s picture

The simplest patch would be to move comments to be rendered into a block and then place the block into the 'footer' block region by default. The block would only actually output something if we were viewing a node with comments.

I made this comment_redenr() optional and much more in this patch - http://drupal.org/node/24804. It needs some updating before being considered for core.

stmh’s picture

Hi,

I reviewed your patch before posting mine, and indeed it does mostly the same. But I want more flexibility, I don't want to render the comments in a separate tab, perhaps I want to render the comments on a separate page, perhaps I want a completely different layout of comment-creation and -displaying.

With HEAD this is not possible, even with your patch it is not possible right of the box.

The only thing my patch does, is to suppress the comments when showing the node. So the developer can decide how and where the comments should be displayed.

As a theme-developer it is hard to break drupal's output-paradigm without hacking core. And this is the last I want to do.

For displaying comments in a separate tab it is not needed to patch core in that way. You can code a small module which adds the menu-item and the callback-function which calls comment_render. The only patch you'll need is mine ;)

What do you think of that idea?

Jaza’s picture

Version: x.y.z » 6.x-dev
Status: Needs review » Needs work

I don't think that either this patch (adding a new config option), or moving comments into a 'footer block', is the right solution for drupal 6. Probably the best solution - now that the node body is constructed from a structured array - would be to add the comments as an element to the node body. Users can then override this element in a contrib module if they want to.

FiReaNGeL’s picture

Category: feature » bug

Stumbled upon this issue today - as of now, the comments section can't be moved where I want to, its always at the end of the node. The only solution so far involve hacking the core : http://drupal.org/node/122240#comment-272809

Is is too late to get a way to display comments where we want to in node.tpl.php?

FiReaNGeL’s picture

Title: new node-settings to split comments from node-output » Can't easily move comment form in a theme

More descriptive title

gollyg’s picture

+1 for jazas approach (adding the comments to the node->content array).

It makes logical sense to move the placement of comments into the node theming process. Whilst most people will be happy with comments at the end of the post, why deny the flexibility.

Using blocks seems to move node content/functionality into a supplementary area.

As a makeshift solution for 5, you can simply add the results of comment_render to your phptemplate variables to make them available to your node template file.

You still need to disable comments in core. Urghh.

moshe weitzman’s picture

Status: Needs work » Closed (duplicate)

I implemented Jaza's suggestion - #350984: Kick comment rendering out of node module