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

system.verbs.builtins.radio.weblog.getCommentLink

on getCommentLink (postnum, adrblog=radio.weblog.init ()) {
	<<Changes
		<<11/11/02; 5:29:22 PM by JES
			<<Encode & characters in the comments page URL as &.
		<<10/17/02; 12:02:37 AM by JES
			<<A bottleneck routine for getting the comment link for a weblog post. Used by radio.html.commentLink and radio.weblog.writeRssFile.
	if defined (radio.data.appProfile.flCommentsEnabled) {
		if not radio.data.appProfile.flCommentsEnabled {
			return ("")}};
	if not adrblog^.prefs.flCommentLinksEnabled {
		return ("")};
	local (linkarg = "");
	try { //set link
		local (url, catname = "");
		try { //it may be possible for getUrlForPost to fail. we don't want that to cause an error.
			local (pta = html.getPageTableAddress ());
			if defined (pta^.categoryName) { //set catname
				catname = pta^.categoryName}};
		if radio.weblog.getUrlForPost (@adrblog^.posts.[string.padWithZeros (postnum, 8)], @url, catname, adrblog) {
			linkarg = "&link=" + string.urlEncode (url)}};
	return (adrblog^.prefs.commentsPageUrl + "?u=" + user.radio.prefs.usernum + "&p=" + postnum + linkarg)}
<<bundle //test
	<<radio.weblog.getCommentLink (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.