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');
}
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | comment.module.patch.new | 1.24 KB | arthurf |
| #5 | comment.module_57.patch | 304 bytes | arthurf |
| #3 | comment.wrapper.patch | 3.1 KB | arthurf |
| #2 | comment.patch.new | 678 bytes | arthurf |
| comment_30.patch | 123 bytes | arthurf |
Comments
Comment #1
Steven commentedI 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
Comment #2
arthurf commentedWoops, sorry about the bad diff. Here's another go.
Comment #3
arthurf commentedOk, 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:
and here's a new patch for the comment module. 1 line, hooray!
Comment #4
markus_petrux commentedIt looks like this patch is not taken from latest CVS version?
Comment #5
arthurf commentedWoops, you got me on that. Here's the patch against the HEAD version of the comment.module
Comment #6
chx commentedComment #7
arthurf commentedThis 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.
Comment #8
pfaocleComment #9
LAsan commentedStill applies to current version?
If not, fell free to close topic.
Comment #10
casey commentedThere is a comment wrapper in D6/D7
http://api.drupal.org/api/function/template_preprocess_comment_wrapper/7