w3easyComment Manual

Comment or Guestbook Script

w3easyComment Manual

Postby admin » 07.12.2011 15:15

SCRIPT:
w3easyComment
(C) 2010/2011 Joachim Haack, http://w3easy.org

REQUIREMENTS
PHP 5 (maybe also PHP 4 will do), NO DATABASE required.

LICENSE
GNU General Public License, Version 3

DESCRIPTION
With the w3easyComment script you can add a comment functionality to any page of your site that you want to comprehend one. The script will automatically detect from which page a comment is submitted and will allocate the comment to the respective page.
You can even use the script as guestbook.
As it is our philosophy it is a standalone module and can be put in any php supported website that accepts external scripts.

Main features
- Use as comment module or as guestbook
- Edit entries and configuration online
- Review comments before they are published (optional)
- Get informed about new submissions by mail (optional)
- Set maximal number of comments
- Set maximal number of entries per session
- Allow or disallow website submission
- Set default link attributes for websitelink [(no)follow, target='_blank'] (new)
- Set display order (fifo or lifo) (only XL- version)
- Display or hide comments by default (only XL- version)
- English and German language files (new)
- Detailed guide for easy installation (new)
- No database required

INSTRUCTIONS
Installation
First unpack the script folder.
Now open the file "config.inc.php" and specify the settings as it fits.
(You may also specify or change the config settings after upload in the administration area).

Code: Select all
<?php
// general settings
$domain             = "http://yourdomain.com";
// $domain             = "http://localhost"; // for testing in local XAMPP
$charset            = "utf-8"; // ("utf-8" or "ISO-8859-1" or "...")
$admin_user         = "admin"; // choose admin name
$password           = "admin"; // choose admin password
$w3eC_path_to_site  = "../../../"; // path to your startpage
$w3eC_path_to_admin = "../"; // path to your main admin area

// mail settings
$recipient          = "mail@yourdomain.com"; // mailaccount for info/review mail
$subject            = "Comment for THIS PAGE"; // mail subject

// specific settings
$lang               = "en"; // "en" or "de"
$guestbook          = ""; // "" or "yes"
$doctype_XHTML      = ""; // "" or "yes"
$showsite           = "yes"; // "" or "yes" // user can enter his website
$target_link        = "_blank"; // "_blank" or "";
$nofollow           = "yes"; // "" or "yes"
$check              = "yes"; // "" or "yes" // review entry before they are published
$comm_notify        = "yes"; // "" or "yes". "yes" only works, if $check = "no";
$max_chars          = 5001; // max number of characters of an entry
$max_submit         = 3; // max number of submissions per session (0, 1, 2, 3...). "0" means "no limits".
$max_entries        = 12; // max. number of comments
$sort               = ""; // "" or ascending" (default = "" = "descending")
$show_comments      = "no"; // "yes" or "no" // default setting for comments display

// VERY SPECIAL SETTINGS - DO NOT TOUCH UNLESS YOU KNOW EXACTLY WHAT YOU DO...
$php_ext             = "?"; // look 12. ("?" or "&" [or "&" ???])
$cms_special_ext     = ""; // ("" or f.e. "?Module:w3eComment")
?>

Then upload the main script folder "w3easyComment/" to your webspace.
Make sure that only you have access to the scriptfolder.
(I'd recommend htaccess directory protection using our w3easyProtect script).
Make sure that you have permission to create files and folders in the following directories:
(The term 'XY' stands for 'Free' resp. 'Pro' version)
"w3easyComment_XY/comm_fold/"
"w3easyComment_XY/comm_fold/comments/"
"w3easyComment_XY/comm_fold/comments_new/"
"w3easyComment_XY/comm_fold/comments_new_links/"
(chmod folders to 775 should do. Elsewise try 777.)
Make sure that you have permission to edit the following files:
"config.inc.php"
"uniqid.txt"
"result.txt'
(chmod files to 664 should do. Elsewise try 666.)

Now upload the subfolder "w3eC_CssJs/" containing the files "styles.css", "styles_ie6.css" and "w3eC_magic-box.js" to the layout folder of your website (resp. as you have specified in the config).

To include the comment function in your site I recommend to have a look at the source code of the "index.php" file in the script folder.
First make sure that the page always will start a session when accessed. If the site not yet uses sessions, write "session_start();" on top of the page.
Code: Select all
<?php session_start(); ?>

As you can see also in the "index.php", there are 4 parts that must be inserted in the page resp. in the template.

Each part begins with:
<?php
###_w3eC_insert-X_begin_###

and ends with:
###_w3eC_insert-X_end_###
?>

You have to edit only the 2 paths in the 1. insert part: The path from the page where the script is included
a) to the 'w3easyComment_XY/' script folder.
b) to the 'w3eC_CssJs/' folder, i.e. the folder that contains the styles and the javascript.
Do not forget the trailing slash!
(Note: it must be the paths from the page that is active, i.e. from the site, that is shown in the browser line.)

Now insert the 4 parts in your page as they are inserted in the "index.php" page:
The 1. insert part must be above the <head> tag of the page within a php area.
Code: Select all
<?php
###_w3eC_insert-1_begin_###
// Edit the following 2 paths:
$w3eComment_path = "YOUR/PATH/TO/w3easyComment/";
$w3eC_cssjs_path = "YOUR/PATH/TO/w3eC_CssJs/";
// DO NOT EDIT
ob_start(); // begin
include ($w3eComment_path."comment.php");
$w3easyComment = ob_get_contents();
ob_end_clean();
###_w3eC_insert-1_end_###
?>

The 2. insert part must be inserted between the <head> and the </head> tags.
Code: Select all
<?php
###_w3eC_insert-2_begin_###
// DO NOT EDIT
echo $w3eComment_css;
echo $w3eComment_ie6_css;
echo $w3eComment_js;
###_w3eC_insert-2_end_###
?>

With the 3. insert part you have to replace the <body> tag of the site. No worries - there still will be a body tag for your site - hopefully...;)
Code: Select all
<?php
###_w3eC_insert-3_begin_###
// DO NOT EDIT
if (!isset ($body)){$body = "<body>\n";}
else {$body == $body;}
echo $body;
###_w3eC_insert-3_end_###
?>

The 4. insert part must be between the <body> and the </body> tags. With this part the comment function is displayed on your page.
Code: Select all
<?php
###_w3eC_insert-4_begin_###
// DO NOT EDIT
echo $w3easyComment;
###_w3eC_insert-4_end_###
?>

USAGE
User Entries
If the comment review function ($check) is activated, the entry will not be published at once. An email will be sent to the admin containing a link to the entry. Following this link the admin can review, i.e. accept, edit or delete the entry.
To edit an entry, just edit the text in the text area.
To publish an entry, type the admin password in the security field and press "submit".
To reject (=delete) an entry, type the admin password in the "security" field with a trailing "_del" behind and then press "submit".
If the notify function is activated, the entry will be published at once. An email will be sent to the admin containing a link to the entry.
If neither the review function is activated nur the notify function the the entry will be published at once.

Admin Entries
As an admin you can always publish an entry at once, but you may not use the admin username for the 'Your Name:' field. To publish your entry you only have to type the admin password in the security field.

Administration
As an admin you can check about new entries, edit and review them. Moreover you can view and edit the entry file, the config file or you can view the help file.
To access the administration, type the admin user name in the "your name" field and the admin password in the security field.
Note: Each admin action has to be confirmed by typing again the password in the security field, also the selection of any file you want to edit or view and also if you want to save your edits.

VERY IMPORTANT:
IF YOU EDIT THE ENTRY FILE, MAKE SURE THAT THE CURSOR WILL STAY EXACTLY AT THE BEGINNING OF AN EMPTY LINE BELOW THE LAST ENTRY AND THAT THERE WILL BE NO WHITE SPACES BEHIND THE CURSOR BEFORE YOU SAVE. OTHERWISE YOUR ENTRY FILE MIGHT GET MESSED UP AT ONCE OR BY THE NEXT ENTRY.


Have fun and take it w3easy...
;)
User avatar
admin
Administrator
 
Posts: 21
Joined: 17.03.2011 17:36

Return to w3easyComment

Who is online

Users browsing this forum: No registered users and 0 guests

cron