I need to know if there's a variable for node.tpl.php for identifying if the node has comments on it or not.

What I want to do is print title for the comments on the end of every nodes that has comments replied to it. For example the title would be:

"30 excellent readers comments to "title_of_node" "

Since I can't do that on comment.tpl.php (every comment would have one of this if I make it in there) I thought I'd make it on node.tpl.php but there's no variable to identify if there's as far as the handbook is concerned.

Am I doing this the right way or is there something else that I can do to do this.

All help are greatly appreciated.

Domo Arigatou ^_____________^

Ed

Comments

roopletheme’s picture

<?php if ($comment_count) { ?>
  <?php print $comment_count ?> excellent readers comments to <?php print $title ?>
<?php } ?>

www.roopletheme.com

ass45sin’s picture

Works like a charm.. roopletheme ^__________^

Er.. once thing though.. where does the comment_count variable come from? I didn't see it on the node.tpl.php handbook..

Again.. thank you very much.

Ed

roopletheme’s picture

I'm sure there's a couple of handbook pages out there somewhere, but we usually use the search when we're looking for this kind of thing. A drupal.org search for 'comment count' should pull up some relevant info.

There are a lot of tricks to finding the variables available from any part of your theme. You can do a vardump from some content item, or some other type of PHP fun. But if you want to make it easy, just install the devel module. You'll get a 'dev render' tab for every page, which is full of great stuff. You wouldn't want to run a live site with this module active, but it sure makes development easier. It crashes our site when we enable the 'collect query info' option (though we've seen a lot of other sites use this feature), so we just leave that turned off. But it's very useful.

www.roopletheme.com

ass45sin’s picture

Ah I see.. will definitely try the devel module.

Greatly appreciate your help.

Hope that someday can make a theme as good as yours does.. ^______^

Thanks again.

Ed

EDIT: Tried it.. and damn it is VERY helpful.
haven't screwed up with the local installation yet

Although it does raise another problem for me. But I'll manage. ^______^