Needs work
Project:
Comment Display
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2008 at 16:58 UTC
Updated:
13 Nov 2010 at 18:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
entrigan commentedI agree whole-heartedly. This is a fantastic module, and making the $comments variable available to all node templates would make it amazing. Also this, or something similar should be part of core.
Comment #2
entrigan commentedOk I opened up the code and it is amazingly simple, so simple in fact, it might better be handled with some functions in your theme's template.php file. Anyway, I basically duplicated the page preprocess function as a new function comment_display_preprocess_node, which then makes the variable available to all node template files.
This is my first patch (simple as it may be) so please let me know if anything is awry.
Comment #3
sunI should probably commit the patch in #326342: Allow to output comments in a block to allow for this feature. Therefore, testing of the other issue would be appreciated.
Comment #4
sn0rcha commentedI can't get that to work in a zen sub theme some reason.
Any ideas?
Comment #5
valderama commentedhi!
did you manage to make it work in a zen-subtheme so far?
greets,
walter
Comment #6
valderama commentedit works for me now... in the end i just put the preprocess function in the template and replaced the "phptemplate" prefix with the name of my theme ("eca"):
function eca_preprocess_node(&$vars) {
$vars['comments'] = '';
if (function_exists('comment_render') && !empty($vars['node']) && $vars['node']->comment) {
$arg2 = arg(2);
$vars['comments'] .= comment_render($vars['node'], ($arg2 && is_numeric($arg2) ? $arg2 : NULL));
}
}
____
in the node template you then have the $comment variable. i also had to print out the $links variable by hand, to get the "login or register to post comments" link, when there is no comment there already:
hth,
walter
Comment #7
jafar104 commentedValderama's comments worked like a charm, just changed the theme's name to my theme's name and inserted that into template.php, then added the variable $comments to my node.tpl.php file.
Thanks!
Comment #8
jrao commentedActually you can just call comment_display_preprocess_page in your template_preprocess_node, instead of copying the code inside that function.
Comment #9
sunThis patch needs to be re-rolled due to #326342: Allow to output comments in a block
Comment #10
haysuess commentedI couldn't get this to work. I put this in my template file:
And this in my node.tpl.php:
It didn't work.
I have the plugin working fine, but my comment form is also being displayed on the node edit page, which is obviously undesirable.
Comment #11
haysuess commentedNo offense, but CommentBlock is a much better module. It uses Views and is much easier,, more flexible, and doesn't require changing of page.tpl.php or node.tpl.php. You might want to link to it from the front page of this module.
Here it is: http://drupal.org/project/commentblock
Comment #12
entrigan commented@#11,
I would not say your statement was offensive, but I do think it is rude, and at the least unwarranted. CommentBlock and Comment Display take a very different approach to the same problem. Comment Display I would guess based on it's approach is faster, while CommentBlock gives non-coding admin's control over the display.
Different, not better.
Comment #13
haysuess commentedSorry if it was rude, but it is much more flexible, and easier, and since it is views/block based can be customized much more.
Comment #14
entrigan commentedFair enough, and thanks for the link. I had not known about that project.