Include the Script

The script can be included into PHP files or into SHTML (using SSI) files.

If you are unsure if SSI is the right solution for you, you can rename your HTML files to *.php. You can use a file manager (i.e. Explorer on Windows) to rename your files.

Include into an existing PHP File

If the file(s) you want the Comment Script include into already have the extension .php, it should be very easy to get the script to work.

Step-by-step:

  1. Start your browser and log in in your admin area (www.example.com/comments/admin/). Choose 'Include' from the navigation menu. Select PHP as include type and download the include.php. Upload the file include.php into the folder where your files reside that you want to implement with Comment Script.

  2. Open the file, into which the comment form shall appear, in a text editor. Add the following PHP include statement at the very top of your existing PHP file. It is important that there are no characters, line breaks or white spaces in front of that statement.

    <?php include './include.php';

    [...]


    In case you have HTML code in your PHP file, it would have to look like this:

    <?php include './include.php'; ?>

    <html>
       <head>[...]</head>
       <body>[...]</body>
    </html>

  3. Add the link to the Comment Script CSS File to the <head> part of your HTML page. You can find the link in the admin area, section "Include".

  4. Paste the echo statement to the place in your existing PHP file where you want the Comment Script content to appear.

    echo $c5t_output;

    In case you have HTML code in your PHP file, it would have to look like this:

    <?php echo $c5t_output; ?>

  5. Done.

 

By default the script uses the request URI as a unique identifier to assign comments to their corresponding pages. The request URI is the path including all parameters behind the hostname of a URL. I.e.:

URL: http://www.example.com/news/page.php?id=231

The request URI would be:

/news/page.php?id=231

It is also possible to make the script using external identifiers which do not depend on the request URI. Add following line to your PHP file above the line where you include the script. It would have to look like this:

<?php

$c5t_identifier_key = 'your_individual_identifier';

include './include.php';

?>

Include into an existing HTML file

If your files have the extension .html, you have three options to include the script:

  • Rename the file and change the file extension from .html to .php

  • Don't change the file extension but make the HTML file being treated as a PHP file

  • Rename the file and change the file extension from .html to .shtml (SSI)

  • Don't change the file extension but make the HTML file being parsed as SSI file

Rename the file extension from .html to .php

This would be the easiest option. Once you have changed your .html files to .php files, you can follow the instruction in the chapter "Include into an existing PHP File".

Make an HTML file being parsed as PHP file

If PHP is running as Apache module on your server, you can create an .htaccess file with following content and upload it to your server:

AddType application/x-httpd-php .php .html

If PHP is running in CGI mode on your server, it can be trickier to get .html parsed as PHP file. If in doubt, contact your webhost.

Create an .htaccess file with following content and upload it to your server:

AddHandler application/x-httpd-php .php .html

If that doesn't work, try this one:

AddType x-mapp-php4 .html

If that doesn't work, try this one:

AddType x-mapp-php5 .html

If you had no luck with all of the above options and your webhost is not of help, search the web for: htaccess html parsed php cgi

Once you have your .html being parsed as PHP files, you can go to chapter "Include into an existing PHP File" and follow the steps to include the script into a PHP file.

Alternatively, you can make each individual .html file being parsed.

<Files yourpage.html>
    AddType application/x-httpd-php .html
</Files>

Rename the file extension from .html to .shtml (SSI)

If SSI (Server Side Includes) is enabled on your server, files with the extension .shtml will be treated as SSI files.

If SSI is not enabled on your server, this is what you can do. Create a new file with the name .htaccess. Open the file in a text editor and paste this code in the .htaccess file:

AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes

Save the .htaccess file and upload it to your server (into the folder where the .(s)html files reside .

Make an HTML file being parsed as SSI file

If you want to use .html instead of .shtml, instead of writing, you need to create a .htaccess file with this line:

AddHandler server-parsed .html

If you had to activate SSI like in the chapter above, just replace the line

AddHandler server-parsed .shtml

with

AddHandler server-parsed .html

Save the .htaccess file and upload it to your server (into the folder where the .(s)html files reside .

Server Side Include (SSI)

Use the include.php file to include Comment Script into an SSI HTML file.

Step-by-step:

  1. Download the file include.php from the admin area. You'll find that file in the section "Include". Select SSI as include type. Upload the file include.php into the folder where your files reside that you want to implement with Comment Script.

  2. Open the file, in which the comment form shall appear, in a text editor. Add the following SSI include statement to your existing HTML file.

    <!--#include virtual="./include.php?c5t_ssi=1"-->

    You can put it where you want. There is no need to place it at the top of the page like in the PHP include.

    Example:

    <html>
       <head>
        <title></title>
      </head>
      <body>
       [...]

         <!--#include virtual="./include.php?c5t_ssi=1"-->

      [...]
       </body>
    </html>

  3. Add the link to the Comment Script CSS File to the <head> part of your HTML page. You can find the link in the admin area, section "Include".

  4. Done.

 

Please note: In case a user does not fill out the required fields of the form, the error screen of the script appears. That error screen uses the standalone template file layout.tpl.html. You might want to customize that template to match the layout of your website.

Please note: The pagination feature does not work in SSI mode.