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');
}
AttachmentSizeStatusTest resultOperations
comment_30.patch123 bytesIgnored: Check issue status.NoneNone

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.

AttachmentSizeStatusTest resultOperations
comment.patch.new678 bytesIgnored: Check issue status.NoneNone

#3

Title:Wrap comments in single div» Single template wrap

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!

AttachmentSizeStatusTest resultOperations
comment.wrapper.patch3.1 KBIgnored: Check issue status.NoneNone

#4

Status:needs review» needs work

It looks like this patch is not taken from latest CVS version?

#5

Title:Single template wrap» Patched against HEAD

Woops, you got me on that. Here's the patch against the HEAD version of the comment.module

AttachmentSizeStatusTest resultOperations
comment.module_57.patch304 bytesIgnored: Check issue status.NoneNone

#6

Title:Patched against HEAD» Single template wrap

#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 );
  }
AttachmentSizeStatusTest resultOperations
comment.module.patch.new1.24 KBIgnored: Check issue status.NoneNone

#8

Version:4.7.0-rc3» x.y.z

#9

Version:x.y.z» 7.x-dev

Still applies to current version?

If not, fell free to close topic.

#10

Status:needs work» fixed

There is a comment wrapper in D6/D7

http://api.drupal.org/api/function/template_preprocess_comment_wrapper/7

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here