Once the script installation is complete you will need to add the script to your page(s). To do this you will need at least one file to add the script to. You may already have this file existing somewhere on your site, perhaps it's an article that you have written or some other useful information. If you don't then you will need to create one now. Once you know which file to add the script to, move onto the steps below. The file should ideally be a PHP file. If it's a HTML file then read the 'HTML Pages' section below.
In the package you downloaded, there is an example.php file which you can look at.
The first step for integration is to add the following to the very first line of the file. It is necessary for session-dependant features to work. By first line, this means even above the <!DOCTYPE html> and <html> lines. If you already have those lines then there is no need to add them again.
<?php session_start(); ?>
Next you need to add the following lines inside the HTML head tag of the file. The first line declares the UTF-8 charset which means that foreign characters can be displayed. If you have the 'ISO-8859-1' charset tag, or any other charset tag, please remove it and replace it with this UTF-8 one. The second line makes the page responsive to it can be viewed on mobiles and tablets. If you already have these lines then there is no need to add them again.
The last part is the code to actually display the comments and the comment form. This should be added somewhere in your HTML body tag, wherever you want the comments to be shown.
The identifier can contain any value. Just make sure that it's unique to each page that you add the script to.
The reference should be a short descriptive term of the page. It is shown to your visitors. Using the heading of the page is a good idea.
The folder is the name of the /upload/ folder that you renamed in step three of the installation guide. Make sure it ends in a forward slash.
There is never any need to edit the last line.
<?php $cmtx_identifier = '1'; $cmtx_reference = 'Page One'; $cmtx_folder = '/upload/'; require($_SERVER['DOCUMENT_ROOT'] . $cmtx_folder . 'frontend/index.php'); ?>
If you want to add the script to many pages then you won't want to do this manually. Fortunately, as of Commentics v1.4, there are several built-in features to make this easier. By entering keywords into the $cmtx_identifier and $cmtx_reference variables the script can perform actions to replace these keywords with dynamic information.
If you have many pages then there's a good chance that you have a database-driven website where each page already has a unique ID which you can supply to Commentics. Using this ID is always best.
If you have only a few pages then manually type in a unique ID for each page.
Most of the code for Commentics is written in PHP, meaning that for integration a normal HTML file won't work. Fortunately there are (at least) a couple of options available.
AddHandler application/x-httpd-php5 .html .htm .shtml
# If your host is 'Go Daddy', or the above does not work, try this line instead AddHandler x-httpd-php5-cgi .html .htm .shtml
Redirect 301 /somepage.html http://www.example.com/somepage.php
If your site uses a login system, you may want to pass some of this information to Commentics so that your visitors won't need to fill in the form. Fortunately, as of Commentics v2.0, this is possible by adding a few lines to the top of your integration code.
$cmtx_name = ''; $cmtx_email = ''; $cmtx_website = ''; $cmtx_town = ''; $cmtx_country = ''; $cmtx_state = '';
After adding the above lines, you may want to disable or hide the fields to make it quicker and simpler for your visitors to complete the form. As of Commentics v2.4, this can be done by changing the settings in 'Settings → Layout → Form'.
While the integration should go as intended if you follow the instructions correctly, there are certain errors that may appear.