1

I have a template file node-contenttype.tpl.php. There I´m trying to print the comments of that node via

print render($content['comments']);

but only the comment form is rendered. So im looking into the comment-wrapper.tpl.php and the comment.tpl.php. When im writing something in the comment-wrapper.tpl.php, for example a little bit of dummy text, it is printed. But when im doing this in the comment.tpl.php, nothing happens.

Inside the comment-wrapper.tpl.php is the call

print render($content['comments']);

but no comment is rendered.

So the problem seems to bee that the comment.tpl.php is not called. I have find out that the comment Array in comment-wrapper.tpl.php is empty, too.

Can anybody help please?

4

2 回答 2

3

Maybe Not the best way forward, but you can also use this in node-contenttype.tpl.php

<?php 
echo "<pre>";
$node_view = node_view($node);
foreach($node_view['comments']['comments'] as $key=>$value)
{
    if(is_numeric($key))
    {
        print_r($value['comment_body']['#object']->comment_body['und'][0]['safe_value']);
    }
}
echo "</pre>";
?>
于 2013-03-24T08:30:15.510 回答
0

It was a language problem. The language was set to "english", i have set to undefined and now the comments are rendered.

But i have no idea why..

于 2013-03-26T23:28:02.070 回答