Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

HaloScan

Summary: Another commenting recipe, leveraging the power of the HaloScan service.
Version: 0.1
Prerequisites:
Status: first release ... but operational!
Maintainer: EuGeNe Van den Bulke http://www.3kwa.com
Categories: Comments Blog

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

Description

Want to allow you user to comment and tracback on your site without too much trouble? Try leveraging the power of Haloscan and web services dedicated to doing just that and doing it right!

It is as simple as typing (:haloscan:) in the page you want people to be able to comment on!

Notes

This recipe lives on http://www.3kwa.com/Tutorial/HaloScan and plays well with Logbook which lives on http://www.3kwa.com/Tutorial/Logbook.

Release Notes

version 0.1 has been released on the 17th of June 2007 it is running on http://www.3kwa.com in every Logbook entry.

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

Comments

This tutorial is great, but it doesn't quite work with Balu's blog method due to the blog overview (list of pages) and actual (permalink) pages having different addresses. For example, on the overview page ('Blog.HomePage' for me), every comment link has that overview page as its name/id.

To correct this, I first removed the $HTMLHeaderFmt line from the file (doing it locally below), then changed the Markup to:

Markup(
    'haloscan',
    'directives',
    '/\\(:haloscan (.*):\\)/e',
    "Keep(haloscan('$pagename', '$1'))"
);

Could have just replaced $pagename with $1, but I like having the pagename for possible future expansion. Next, change the haloscan function to the following:

function haloscan($pagename, $name) {
    global $HTMLHeaderFmt;

    $HTMLHeaderFmt['haloscan'] = '<script type="text/javascript"
src="http://www.haloscan.com/load/$HaloScanUsername"> </script>';

    $comment = "<a href=\"javascript:HaloScan('$name');\" target=\"_self\">
<script type=\"text/javascript\">postCount('$name');</script></a>";

    $trackback = "<a href=\"javascript:HaloScanTB('$name');\" target=\"_self\">
<script type=\"text/javascript\">postCountTB('$name');</script></a>";

    return $comment . " | " . $trackback;
}

Notice that adding $HTMLHeaderFmt in the haloscan function means that only pages that actually show comments will bother to load the haloscan pages and javascript. Then, in the BlogOverviewTemplate and BlogDetailTemplate pages (from Balu's system) I use the following (respectively):

(:haloscan {=$Name}:)     <-- for BlogOverviewTemplate
(:haloscan {*$Name}:)     <-- for BlogDetailTemplate

This now appears to work perfectly.

-- pjv, Thursday 4th October, 19:17 GMT

See Also

Contributors

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM