By brewthis on
Hi,
How do I check whether a node has comments enabled or disabled? Right know I have the same "Click to comment" text even if the node doesn't allow comments.
Thanks.
Hi,
How do I check whether a node has comments enabled or disabled? Right know I have the same "Click to comment" text even if the node doesn't allow comments.
Thanks.
Comments
Admin -> Content -> Content
Admin -> Content -> Content Types -> Edit -> Comment settings
Thank you, however it wasn't
Thank you, however it wasn't quite what I meant.
I need an if-sentence in order to be able to print X if comments are enabled and Y if disabled.
Anyone?
Anyone?
_
In what context are you doing this? Is $node available?
Yep, got $node available -
Yep, got $node available - $links and $submitted as well if that matters.
_
Excellent, then you can use:
Lovely, thanks a lot! Next
Lovely, thanks a lot!
Next time, how do I know what's available to me?
_
It rather depends on what context you're in. However, in tpl files you can usually use
print_r($vars)orprint_r($variables)to get a list of variables. However, that's often a lot of output. If you're in the node.tpl.php and you know $node is available, you can useprint_r($node)to see what's available as part of that specific variable.