I created a view to generate a page which contains the comments appended to a particular node, on the views-view-row-comment.tpl.php file it states:
* Rather than doing anything with this particular template, it is more
* efficient to use a variant of the comment.tpl.php based upon the view,
* which will be named comment-view-VIEWNAME.tpl.php. This isn't actually
* a views template, which is why it's not used here, but is a template
* 'suggestion' given to the comment template,
This suggestion is not being generated, investigating in the module code, the template suggestions for nodes is being generated on the views.module
specifically here
function views_preprocess_node(&$vars) {
// The 'view' attribute of the node is added in template_preprocess_views_view_row_node()
if (!empty($vars['node']->view) && !empty($vars['node']->view->name)) {
$vars['template_files'][] = 'node-view-' . $vars['node']->view->name;
if(!empty($vars['node']->view->current_display)) {
$vars['template_files'][] = 'node-view-' . $vars['node']->view->name . '-'. $vars['node']->view->current_display;
}
}
}
however no similar function exists for comments...
Can anyone suggest a workaround?
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedGood point. Documented that way but never actually happened. Fixed in CVS. Thanks!
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
sultancillo CreditAttribution: sultancillo commentedThis is still an issue the problem is here:
this:
should be:
Comment #4
sultancillo CreditAttribution: sultancillo commentedReopened issue with above comment
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedI believe the node is always available in all the comment templates, so I don't think there is a real need to put the view on the comment. Also, the comment can be an array I think, which makes it a little less safe to put random data on it.
Comment #6
sultancillo CreditAttribution: sultancillo commentedOK my bad... here's the situation, i had some code on my template.php to go around this... I removed it and installed the original module
Still the template suggestions are not being generated...
Here's the problem...
Should be:
(note the function name)
otherwise this function is never executed and the view object is never attached to the node...
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedAlright, changed in -dev.