allow_comments

Previous page  First page  Next page

allow_comments is a boolean variable that is true if comments are allowed for the article.

 

Comments are allowed or disallowed on a per-article basis. If the author of the article checks the Allow comments checkbox, which is located in the Advanced Article Options sidebar of the Post Article or Edit Article page, allow_comments is true. If the author does not check this checkbox, allow_comments is false.

 

 

Example

 

Here is a very simple example:

 

{{if allow_comments}}

Comments have been enabled. Go ahead and speak your mind.

{{else}}

Comments are not allowed for this article.

{{/if}}

 

In the example above, "Comments have been enabled. Go ahead and speak your mind" is displayed if comments are enabled for the article. If comments are not enabled, "Comments are not allowed for this article" is displayed instead.

 

In the default article template, allow_comments is used to determine whether the inline form for entering comments (the one that appears at the bottom of an article's individual page) should be displayed. Here is a simplified version of the code that does this:

 

{{if allow_comments}}

{{include name="post_comment_inline.html"}}

{{/if}}

 

If comments are allowed, the template file post_comment_inline.html, which renders the comment entry form, is shown.