Jealous of people able to display their blog’s recent comments in the sidebar, I wrote this little script.
It reads recent posts from your site’s comment rss feed and prints n comments out in a nicely formatted div. Using it is as simple as changing one line, uploading the file, and pasting some code wherever you want the recent comments to be displayed.
To use the script, first download it.
Open the file in a text editor. Change the ‘$commentsRSS’ value to your JS-Kit Comments RSS URL. This is the line:
$commentsRSS = 'http://rss.pagesofinterest.net/'; //change this to your comments rss feed
To find your RSS URL, look here: Customizing JS-Kit Comments. Scroll until you see “Setting up the RSS”.
Once you’ve changed that variable, rename the file to “recent-comments.php”, and upload it to your server.
Take note of where you uploaded it to.
< ?php include('PATH_TO/recent-comments.php') ?>
wherever you want your recent comments to be displayed.
Change “PATH_TO” to the path to the file, e.g. “http://pagesofinterest.net/code/download/recent-comments.php”. Remove the whitespace between < and ?. Save, then load the page in your browser. You should see your recent comments displayed wherever you pasted the code. If you see a strange error message instead, try pasting the contents of the recent-comments.phps file wherever you want the recent comments to be displayed, instead of the above “include” statement.
Any problems, leave a comment and I’ll try to help.
To learn more JS-Kit tricks, read the following posts:
JS-Kit Comments + Greybox on Any Page
JS-Kit Comments for Each Blog Entry
JS-Kit Comments: Correct Usage of the â€˜Permalinkâ€™ and â€˜Pathâ€™ Attributes
Styling JS-Kit Comments
JS-Kit Comments: Correct Usage of the ‘Permalink’ and ‘Path’ Attributes