Reputation: 240
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?
Upvotes: 1
Views: 3389
Reputation: 240
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..
Upvotes: 0
Reputation: 31
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>";
?>
Upvotes: 3