1.) In terms of performance, this module does not redraw the comments - before it does the following unset, it caches the comments into a static variable for use in the block.
unset($node->content['comments']);
2.) This module also moves the links associated with the comments.
unset($build['links']['comment']);
I would be more than happy to remove this module if those two things are addressed in yours. That said, let me admit that I looked but couldn't find yours before I wrote this - otherwise, I would have offered a patch to your module instead of writing this one. The views support yours offers is obviously missing in mine.
i started implemnting your approach, seems better just caching the rendered comments.
i have one question about the
function comment_block_static_comments($nid, $build = false, $node = false)
when is the else entered, meaning under what circumstances is $build not TRUE
if ($build) {
$comments[$nid]['links'] = $build['links']['comment'];
$comments[$nid]['comments'] = $build['comments'];
} else {
#normal behavior will be that the node calls this function before
if (!isset($comments[$nid])) {
$comments[$nid]['links'] = '';
$comments[$nid]['comments'] = comment_node_page_additions($node);
}
return $comments[$nid];
}
Comments
Comment #1
SolomonGifford commentede-anima,
There are two differences between our modules.
1.) In terms of performance, this module does not redraw the comments - before it does the following unset, it caches the comments into a static variable for use in the block.
2.) This module also moves the links associated with the comments.
I would be more than happy to remove this module if those two things are addressed in yours. That said, let me admit that I looked but couldn't find yours before I wrote this - otherwise, I would have offered a patch to your module instead of writing this one. The views support yours offers is obviously missing in mine.
Comment #2
marcoka commentedok nice. maybe we can merge one day :)
Comment #3
marcoka commentedi started implemnting your approach, seems better just caching the rendered comments.
i have one question about the
function comment_block_static_comments($nid, $build = false, $node = false)
when is the else entered, meaning under what circumstances is $build not TRUE
Comment #4
SolomonGifford commentedSee line 29.
Comment #5
marcoka commentedlol. no thats not what i meant.
yes the blocks content is filled like this
and then there is also
comment_block_static_comments($build['#node']->nid, $build);
inside commentsblock_node_view_alter
Comment #6
lsolesen commentedWhy not merge these two modules? The difference is really small?
Comment #7
SolomonGifford commentedI have not reviewed their version 2 they have released, but it may satisfy the performance reasons for which I created this one.
Comment #8
SolomonGifford commentedComment #9
SolomonGifford commentedI placed a note on the home page of this module to address this case.