1

I'm having an issue with an undefined variable

Notice: Undefined variable: comment_count in include() (line 33 of ...\themes\simplecorp\node.tpl.php).

This is what my line 33 looks like:

<?php print $comment_count; ?> 

I don't understand this error, Can someone tell me how to do it?

1
  • this error would occur for a node that doesn't have a comment count, as the variable won't have been set. T-34's answer should work to avoid this issue.
    – Geoff
    Jun 13, 2014 at 18:14

1 Answer 1

0

If you want to get rid of this notice, replace your line 33 with:

<?php if (isset($comment_count)) print $comment_count; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.