Posted by arthurf on April 27, 2006 at 12:08am
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | comment.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
In complex theming, it's nice to have all the comments located within a single div, or some more complex style. A two line patch of the comment module and some additions to template.php allow for using a comment_header.tpl and comment_footer.tpl.
Here are the additions to template.php
function phptemplate_comment_header() {
return _phptemplate_callback('comment_header');
}
function phptemplate_comment_footer() {
return _phptemplate_callback('comment_footer');
}| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| comment_30.patch | 123 bytes | Ignored: Check issue status. | None | None |
Comments
#1
I think instead of header and footer we should just have a single theme function which wraps all the comments. Then it can be themed in one place. Good patch though, there is a theming gap here that needs to be filled.
Can you submit a complete, unified diff with fixes?
http://drupal.org/patch
#2
Woops, sorry about the bad diff. Here's another go.
#3
Ok, based on your comments, I redid the process a bit to wrap the comments in a single template called comment_wrapper. Here's the code for template.php:
function phptemplate_comment_wrapper($content) {return _phptemplate_callback('comment_wrapper', array('content' => $content));
}
and here's a new patch for the comment module. 1 line, hooray!
#4
It looks like this patch is not taken from latest CVS version?
#5
Woops, you got me on that. Here's the patch against the HEAD version of the comment.module
#6
#7
This an additional patch that doesn't call the comment_wrapper if there are no comments. I'm not sure if its useful, or if my catch is a good one, given the extra db hit.
if (db_num_rows($result) > 0) {$output = theme('comment_wrapper', $output );
}
#8
#9
Still applies to current version?
If not, fell free to close topic.
#10
There is a comment wrapper in D6/D7
http://api.drupal.org/api/function/template_preprocess_comment_wrapper/7
#11
Automatically closed -- issue fixed for 2 weeks with no activity.