since nearly a week iam trying to customize comments
i searched in several forums and got suggested to create an issue
i hope its the right place
in my opinion its not about customizing the comments.tpl.php
its a lack of possibilitys of drupals comment theming-system itself
please prove me wrong
the $content variable in page.tpl.php gets the node-content and its comments
the problem is that comments are glued to the node (in node.module, function node_show(), line 765: $output .= comment_render($node, $cid); )
there is no $comment variable to place comments and their forms separately in page.tpl.php
what is realy essential for the design of the website i am working on
my page.tpl.php of a single node-view has 3 sections arranged in rows
1. row: the node has a black background with white typo
2. row: a description part with grey background and black typo
3. row: comments with white background and black typo
with this great tip from dvessel in the thread http://drupal.org/node/122240#comment-253072 i managed to catch the comments and place them in my comments-section
i managed this with comment-forms as well by overwriting the box theme in my template.php
while drupal is calling the box theme i catch the box-content by comment titles and urls and keep the content till i call my custom box theme again
function mytheme_box($title = '', $content = '', $region = 'main') {
// variable to save form
static $comment_form;
// Default output.
$output = '';
// try to catch the comment form by its titles or url
if($title == 'Post new comment' || $title == 'Reply' || $title == 'Edit comment' || (arg(0) == 'comment' && arg(1) == 'edit') || (arg(0) == 'comment' && arg(1) == 'reply') || $title == 'test'){
// save the content being send with drupals function and dont pass it
if (!empty($content)) {
$comment_form = $content;;
}
// with my call i dont send any content but pass the content from the previous call
else {
$output .= $comment_form;
}
}else{
$output = '<h2 class="title">'. $title .'</h2><div>'. $content .'</div>';
}
return $output;
}
with successful redirecting of comments or keeping the original way of how drupal handles comments
im still stuck with customizing the comment-forms
as i said, the node content is shown in a black area and the comments are shown in a white area below
- when i want to reply a node:
the node-content is shown in its black area and the reply form is shown in its white area below
- when i want to preview the node comment:
the node-content is shown at the wrong place - its now in the white area below the reply-form
it should be in the black node-area above
(the node is getting appended to the form in comment.module, function comment_form_add_preview() line:1623 with ( $form['#suffix'] = node_view(node_load($edit['nid']));) )
well deleting this line is not the most elegant way i think
- when i want to reply a comment and later see its preview:
the node-content is not shown in its black area where it should be and the reply form is shown in its white area were it should be
- when i want to edit a comment:
the node-content is not shown in its black area where it should be and the reply form is shown in its white area were it should be
- when i want to preview the edited node comment:
the node-content is shown at the wrong place - its now in the white area below the reply-form
there are 14 theme functions declared in comments.module but as far as i can see none of them cares about placing forms and there previews
i managed to get rid of the wrong placed node-view with the hook_form_alter() but putting the node at right place was getting to complicated
of course i also tried around with the comment settings "Display on separate page" and "Display below post or comments"
please tell me if there is another way to place comment-forms than changing the comments.module
sorry for my bad english + thanks a lot for any help
btw. im using drupal 5.1
Comments
Comment #1
cosmicdreams commentedYour english is fine. Doesn't wading through all these module pages make you ill, I know it does for me. Luckily, in drupal 6, core modules like the comment module will be theme-able. Check out the latest beta and try to manipulate the comments. You'll never want to go back.
Comment #2
alpritt commentedComment #3
dvessel commentedIt's still not the most straight forward thing to theme but it's doable.
And a feature request is set for 7.
http://drupal.org/node/214951