PT Comments v2.3 Install
Back to PT Comments
NOTE: v2.3 of this application is compatible with ADF 2.x up to ADF 2.4.x.
Download the Comments Application from the Community Site or from the SVN Repository.
Extract the zip files into the following directory: /ADF/apps/pt_comments/
- Make sure the ADF is setup and running on the site. If the ADF is not setup, then follow the instructions for ADF Installation.
- Open the sites 'ADF.cfc' (See Site Configuration (ADF.cfc) for more info) file (located in your site's /_cs_apps/ directory) in a text editor.
- Locate the Load the ADF Application into application space comment in the file. Add (or uncomment) the following command under the comment section:
- Reset the ADF for the server and site.
The Comments Application has a single Global Custom Element defined within CommonSpot. The element has been exported and is available in the Comments's "exported-objects" folder located at the root of the Comments application directory (e.g. /ADF/apps/pt_comments/exported-objects/)
Optional: You may want to create a new category within the CommonSpot Element Gallery for 'Comments Elements'.
To import these objects, you will need to be an administrator for your site. If you are not a site administrator, consult your Server administrator for more information.
Import the Custom Element:
- Comments (Comments-Custom-Element.zip)
Note: For CommonSpot 9 or earlier import the .zip archives located in the /exported-objects/cs9-or-earlier/ directory
The render handler path for the imported "comments" element must be verified that it has the correct path. During the import process, the render handler path may have been changed to reflect the current site's path.
Review and update the path to reference the ADF path. In most cases, this will just require the element to be unlocked and a change in the path from the site name to 'ADF'. Check the path for the custom field types that were imported with the custom element by unlocking it and fixing the explicit path to point to "/ADF/extensions/".
It is highly recommended that a Comments subsite is created for administrators. This allows security to be setup for the subsite to allow only administrators access for the webadmin.
Your site may already have a webadmin subsite. The steps below will add a comments subsite into the webadmin subsite.
- Create a new subsite under the site root called webadmin.
- Create a new subsite under webadmin called comments.
- Configure the /webadmin/comments/ subsite Content Security to give 'No Rights' to 'Anonymous Users' and 'Authenticated Users'.
- Configure the /webadmin/comments/ subsite Content Security to give permissions to the group of administrators who will manage the Comments.
This page will be used to manage the Comments custom element data records for the site.
- Create page with the name "index" and title is "Comments Manager" in the /webadmin/comments/ subsite.
- Add a Datasheet element into the page.
- Define a View for the Datasheet Element called "All Comments"
- Leave the View Source as the Default: Form Result/Custom Element Sheet
- Select the "Comments" Custom Element and select the following columns:
- UID, DateTimePosted, and Name
- Edit the column for the "UID" field and make the following changes:
- Header: Edit/Delete
- Render Handler: /ADF/extensions/datasheet-modules/1.0/edit-delete.cfm
- Edit the Layout properties for the datasheet:
- Default Sorting: DateTimePosted DESCENDING
- Results Per Page: 50
- Publish the page.
CF Form Protect helps to protect your form from spam. It allows the comments that users enter to have some verification of who is entering the data and makes sure that robots do not submit bogus comments.
- Copy cffp.ini.cfm from /ADF/thirdParty/cfformprotect/ into your /_cs_apps/config directory
- Edit the parameters as you see fit. Please note the email settings.
Adding comments to your page
The comments element, which will be configured in a step below, requires a variable called "request.comments.contentDataPageID". This variable does not exist and will throw an error unless one of two things are done. First, you can add a script to the page directly above where you place the comments element. The script (pageComments.cfm) will define the variable needed by the comments element.
Alternatively, you can add the following line of code to the template-basepage.head file in the site's /templates directory:
<cfset request.comments.contentDataPageID = request.page.id>
If you add the line of code to your template-basepage.head file, then it is not necessary to place a custom script element on every page where you wish to use comments. Adding this code to your template-basepage.head is the preferred installation method. If your site does not have a template-basepage.head file, you may create one. The Commonspot developer's guide explains the requirements for creating the .head file.
- Edit your page
- Optional -- Add a custom script to your page
- Add the comments element to your page
- Update the render mode on this element
- Select "Display existing element data (content reuse)"
- Select "Render results dynamically based on a filter, or display all records."
- click on filter
- select "Subset of records"
- in the dropdown select Comments.contentDataPageID
- Set the comparison to equals
- click the ... next to the value
- enter: request.comments.contentDataPageID
- Sort Order: dateTimePosted ASCENDING
- click save
- submit your page
- Reset the ADF for the server and site.