Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.html.commentLink

on commentLink (postnum, adrblog=radio.weblog.init ()) {
	<<Changes
		<<10/18/02; 11:41:22 AM by JES
			<<If radio.weblog.getCommentLink returns the empty string, then return the empty string.
		<<10/17/02; 12:07:32 AM by JES
			<<Call through radio.weblog.getCommentLink to get the URL for the comment, instead of generating it here.
		<<7/10/02; 4:55:08 PM by JES
			<<Added a link argument to the comment link url. The value is the URL-encoded permalink to the post being commented upon. This will make it possible for comment systems to link back to the original post.
		<<4/23/02; 1:44:32 PM by JES
			<<Added class="commentLink" to the link.
		<<4/18/02; 12:57:16 PM by JES
			<<If radio.data.appProfile.flCommentsEnabled is defined and false, return the empty string.
		<<2/28/02; 1:19:18 AM by JES
			<<Made the comment links backward-compatible with browsers which don't support JavaScript, as well as browsers for which JavaScript has been disabled.
		<<2/23/02; 5:01:19 PM by JES
			<<Changexd the href value of the comment link to javascript:void(0) so that the browser won't go to the top of the page when the comment link is clicked.
		<<2/23/02; 1:19:42 AM by JES
			<<Replace the <%commentLink%> macro with a bit of JavaScript which calls the external comment counter JavaScript, loaded by radio.weblog.render.
		<<2/20/02; 5:32:49 PM by JES
			<<Respect adrblog^.prefs.flCommentLinksEnabled.
		<<2/20/02; 4:39:40 PM by JES
			<<Localized. Made the link text into a pref, so that it can be edited in the prefs system.
		<<2/16/02; 5:39:49 PM by JES
			<<Created. Render a "comment" link for a weblog post.
	local (commentPageUrl = radio.weblog.getCommentLink (postnum, adrblog));
	if commentPageUrl == "" {
		return ("")};
	local (linktext = adrblog^.prefs.commentLinkText);
	bundle { //insert JavaScript for comment counter
		linktext = string.replaceAll (linktext, "<%commentCount%>", "<script type=\"text/javascript\" language=\"JavaScript\">commentCounter (" + postnum + ")</script>", false)};
	local (tooltip = radio.string.getLocalizedString ("misc.clickToCommentOnThisPost"));
	local (onclick = "window.open (this.href, \'comments\', \'width=515, height=480, location=0, resizable=1, scrollbars=1, status=0, toolbar=0, directories=0\'); return(false);");
	local (s = "<a href=\"" + commentPageUrl + "\" onclick=\"" + onclick + "\" title=\"" + tooltip + "\" class=\"commentLink\">" + linktext + "</a>");
	return (s)}
<<bundle //test
	<<radio.html.commentLink (42)



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.