How to add comments to minimal gallery

Sunday, January 11th, 2009

I will integrate this functionality better in 1.0 (yes it will come out at some point… ;) but in the meantime, if you’d like to add comments to your minimal gallery, you can use intensedebate.com.

If you don’t already have an account, sign up, then add a blog, during the second step (i.e.,”choose platform”), select “Generic Install” at the bottom, and copy/paste the javascript code it creates for you, you’ll get something like that:

<script>
var idcomments_acct = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
var idcomments_post_id;
var idcomments_post_url;
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='http://www.intensedebate.com/js/genericCommentWrapperV2.js'></script>

The “xxx…” part will have your unique blog identifier. Now, take that identifier and replace “XXXXX” in the following code with it.

<? if($_SERVER['QUERY_STRING'] != ''): ?>
<script>
var idcomments_acct = 'XXXXX';
var idcomments_post_id = '<?= $id ?>';
var idcomments_post_url = '<?= $site_uri.'/?id='.$id ?>';
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='http://www.intensedebate.com/js/genericCommentWrapperV2.js'></script>
<? endif; ?>

Then paste that code in your minimal gallery template, wherever you’d like to see comments. On a default install, you could put it in /_mg/templates/basic/view_file.php between line 32 and 33. The first and last line in the snippet above is a conditional to remove comments on the home page.

Notes:

If you want comments to show up in all different styles, you’ll have to add the same code in all templates. Make sure you add comments on single entry templates only though, because intensedebate uses the entry ID to know which comment goes where.

Enjoy!

Filed under: minimal gallery