dotCMS - Open Source Content Management System, Ondemand CMS, and Professional Support

Document Search

Article Information

Since Version: 1.6.5
Tags: Comment macros
Updated: 9/21/2009 10:10:59 AM
By: Dean Gonzalez
Doc id: 151340
Print Page: Export to PDF
 

Related Screencasts

Add Commenting on Content
Learn how to use the comment macro to allow users to add comments about the content on your website.

Comment: Add a Generic Comment Component

This macro allows you to add a generic comment component to any contentlet in the system. These comments can be either moderated (creates a workflow) or unmoderated.

Macro Overview:

Syntax:

comment($contentlet.inode)

Arguments:

* contentlet inode - This is the inode of the contentlet that will be commented.


Optional Parameters:

  • $commentForceLogin = 'true'
    (default false) would require a user to login before they can comment. Otherwise, show them a message and the link to the login page.
  • $commentAutoPublish = 'false'
    (default true) controls whether the comment is automatically published or not.
  • $commentUseCaptcha = 'true'
    (default false) shows a captcha image test when adding a comment
  • $copmmentStripHTML = 'true'
    (default false) will remove any html from the comment.
  • commentForceLogin (velocity variable not a parameter)
    Optional: If set to "true" the user should be logged before could submit a comment
    Default: false
  • commentAutoPublish (velocity variable not a parameter)
    Optional: Controls whether the comment is automatically published or not.
    Default: true
  • commentUseCaptcha (velocity variable not a parameter)
    Optional: If set to "true" shows a captcha image to the comment's form, to validate human interaction
    Default: false
  • commentStripHTML (velocity variable not a parameter)
    Optional: If set to "true" any html code that's sent in the comment field would be removed
    Default: false
  • commentTitle (velocity variable not a parameter)
    Optional: If set, that will be the name of the question to comment
  • commentsModeration (velocity variable not a parameter) Optional: If set, that will be the name of the role to assign the workflow
  • maxDepth (velocity variable not a parameter)
    Optional: If set, that will be the number of levels you could make a comment. Comments will be displayed in a threaded view - Comments in reply to other comments.
    Default: 1


Usage:

Use this macro if you want to add a form to comment a contentlet, the macro, will add a form to add new comments and list the comments order by publish date. Special Note: Also set the variable below to enable the audio captcha on Safari on Mac OSX.
#set($commentUseAudioCaptchaHeight = 200)

Examples:

Example 1: A simple example using the required fields

#set($commentForceLogin = 'true') 
#set($commentAutoPublish = 'true') 
#set($commentUseCaptcha = 'false') 
#set($commentStripHTML = 'false') 
#set($commentTitle = 'This is the question to comment') #comment($content.inode)

Example 2: An example showing how to include one or more of the optional parameters

#set($commentForceLogin = 'true')
#set($commentAutoPublish = 'true')
#set($commentUseCaptcha = 'false')
#set($commentStripHTML = 'false')
#set($commentsModeration = 'Editor')
#comment($content.inode)



Post a Comment


Add Comments

   

 
Post

Powered by Olark