I really enjoy using PmWiki as a back-end for websites whether they leverage the wiki nature or not. Many PmWiki users have been looking for proper commenting solutions, generally using the wiki as a blog (a bliki).
My second contribution to the PmWiki Cookbook is the integration of the HaloScan comment and trackback service, a solution to the above mention problem ;)
I would not have thought about if I hadn't noticed it being used on Kib's Lair and Voidspace Python Blog.
Haloscan
The first thing you need to do is sign up for a Haloscan account. It is simple, fast and free!
If you like the service think about donating. It is very frustrating to do something people like and not get any financial return from it (I have a first hand experience with Inline Search).
haloscan.php
The next stage is saving, where you see fit (usually the cookbook/ folder) the following file under the name haloscan.php
/* $HTMLHeaderFmt is an array containing lines to add the <head></head> section of your template. Here we are loading the javascript element required by the haloscan service */
$HTMLHeaderFmt['haloscan'] = '<script type="text/javascript" src="http://www.haloscan.com/load/$HaloScanUsername"> </script>';
/* We now define the (:haloscan:) markup with the Markup function supplied by PmWiki. the /e is necessary because the Keep(haloscan('$pagename')) is a PHP statement that needs to be executed. */
Markup(
'haloscan',
'directives',
'/\\(:haloscan:\\)/e',
"Keep(haloscan('$pagename'))"
);
function haloscan($pagename) {
/* Function returning the HTML required to use the haloscan service. I decided to split it into a $comment and $trackback string for readability purposes. */
$comment = "<a href=\"javascript:HaloScan('$pagename');\" target=\"_self\"><script type=\"text/javascript\">postCount('$pagename');</script></a>";
$trackback = "<a href=\"javascript:HaloScanTB('$pagename');\" target=\"_self\"><script type=\"text/javascript\">postCountTB('$pagename');</script></a>";
return $comment . " | " . $trackback;
}
?>
config.php
All you have to do then, is add the following lines in your config.php (or farmconfig.php), changing the your-haloscan-username to ... and you are ready to roll!
$HaloScanUsername = 'your-haloscan-username';
include_once('cookbook/haloscan.php');
...
Now on whichever page you want to let people comment or trackback, you just have to use the (:haloscan:) markup!
I personally use it for all pages of my blog which uses my Logbook recipe. Henceforth I have a Logbook.GroupFooter page which contains



