HaloScan-Talk

Summary: Talk page for HaloScan.
Maintainer: EuGeNe Van den Bulke http://www.3kwa.com
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

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

Talk page for the HaloScan recipe (users?).