Fixing <MTSimpleCommentCount> so it works outside <MTSimpleComments> in dynamic templates
Like my last post this is a small fix to a problem with the PHP implementation of the SimpleComments plugin. The original perl code allowed the use of the <MTSimpleCommentCount> outside of SimpleComments tags. This is really useful if you want to output info on comments or trackbacks based on how many there are. In my case I want the updated timestamp on my individual Atom feeds to match that of the most recent comment or trackback, but if there isn’t any feedback yet, the timestamp should match the modified date of the entry itself.
For some reason (and I don’t know enough about writing PHP plugins for Movable Type to tell you why) the “official” PHP version of SimpleComments returns null if you try to do this. Luckily kate at geekmum noticed the same problem and figured out that installing one file from Rad Geek’s PHP port fixes the issue. So download that package, and copy function.MTSimpleCommentCount.php to /path/to/mt/cgi-bin/php/plugins/ (make a backup of your original function.MTSimpleCommentCount.php, first). Now you can find the total comment and trackback count in dynamic templates to your heart’s content.
One caveat: I believe the official PHP port allows comment counts to be accessed outside the context of a single entry, but Rad Geek wrote his port before that was a feature. So if you’re using SimpleComments to pull a blog or category-wide comment count in a dynamic template, this “fix” will probably break that.
Popularity: 6% [?]