Copy and paste the following code anywhere between your <head> and </head> tags in your permalink.htm. Repeat for any *_archive.htm templates that you plan to include comments on:
<script type="text/javascript" src="http://www.haloscan.com/load/haloscan-account"> </script>
Copy and paste the following code to your permalink_entry.htm. Repeat for any *_entry.htm templates that you plan to include comments on:
<div class="posted">
<br />$template_postedby <span class="item-creator">$NB_EntryAuthor</span>
$([ "$PERMALINKS" = "1" ] && echo '| <a class="link" href="'${ARCHIVES_PATH}$NB_EntryPermalink'">'$permanentlink_title'</a>')
$([ ! -z "$NB_EntryCategories" ] && echo "| $template_catlinks $NB_EntryCategories") | <a href="http://www.haloscan.com/comments/n1xt3r/`echo $NB_EntryID |sed -e '/[^0-9eTtx]/ s//_/g'`"onclick="HaloScan('$NB_EntryID');return false;"><script type="text/javascript">postCount('$NB_EntryID');</script></a> | <a href="http://www.haloscan.com/tb/n1xt3r/`echo $NB_EntryID |sed -e '/[^0-9eTtx]/ s//_/g'`"onclick="HaloScanTB('$NB_EntryID');return false;"><script type="text/javascript">postCountTB('$NB_EntryID');</script></a>
</div>
As an alternative to placing lengthy and ugly sed commands in your templates it is recommended that you place them instead in a custom entry plugin and adjust your templates accordingly.
For example:
# plugins/entry/haloscan_id.sh - generates haloscan id for entry
NB_EntryCommentID=`echo $NB_EntryID |sed -e '/[^0-9eTtx]/ s//_/g'`