sw:my_two_cents
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sw:my_two_cents [2007/08/21 07:59] – 203.83.117.38 | sw:my_two_cents [2009/07/24 08:43] (current) – old revision restored 87.234.80.129 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== My Two Cents ====== | ||
+ | |||
+ | //My Two Cents// is a simple PHP class to add a comment function to any PHP script, similar to the well known PHP Webnotes script (used in the PHP manuals). PHP Webnotes wasn't updated for several years and has some security problems. This class is much simpler but should be enough for most users. | ||
+ | |||
+ | |||
+ | ===== Getting it ===== | ||
+ | |||
+ | You can check out a copy using darcs: | ||
+ | |||
+ | $> darcs get http:// | ||
+ | |||
+ | Or download a daily generated snapshot: [[http:// | ||
+ | |||
+ | ===== Usage ===== | ||
+ | |||
+ | You need to create a table in a MySQL database using the provided db.sql script, first. | ||
+ | |||
+ | The class file needs to be included and an object has to be created. This object then can be used to display available comments and a comment form. The following shows the simplest possible usage: | ||
+ | |||
+ | <code php> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <?php | ||
+ | require_once(' | ||
+ | $MTC = new MTC(); | ||
+ | $MTC-> | ||
+ | ?> | ||
+ | </ | ||
+ | < | ||
+ | ... | ||
+ | <?php $MTC-> | ||
+ | <?php $MTC-> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The class provides the following functions: | ||
+ | |||
+ | ^ Function | ||
+ | | %%init([page])%% | ||
+ | | comments() | ||
+ | | comment_form() | ||
+ | | comment_count([page])| Return the number of comments for the page (page param is optional) | | ||
+ | |||
+ | To group comments belonging to one page //My Two Cents// uses the $page parameter given in the init function. If you leave the parameter empty the current URL path (PHP_SELF) is used. You may want to specify this your self eg. using a pageid from your CMS. | ||
+ | |||
+ | ===== Advanced usage ===== | ||
+ | |||
+ | The behaviour of //My Two Cents// can be configured through some class properties. You need to set them before calling the '' | ||
+ | |||
+ | ^ Property | ||
+ | | db_host | ||
+ | | db_user | ||
+ | | db_pass | ||
+ | | db_name | ||
+ | | self | mtc.class.php | ||
+ | | blacklist | blacklist.txt | ||
+ | | captcha | ||
+ | | audio | false | Set to true to enable audible CAPTCHAs (requires captcha option) | | ||
+ | | addcss | ||
+ | | target | ||
+ | | adminpass | | A password needed to delete a comment | | ||
+ | | notify | ||
+ | | gravopts | ||
+ | | lang | english strings| This array holds all language strings used | | ||
+ | |||
+ | ===== Administration ===== | ||
+ | |||
+ | An administrator can delete comments by enabling the admin mode. To do so add the parameter '' | ||
+ | |||
sw/my_two_cents.txt · Last modified: 2009/07/24 08:43 by 87.234.80.129