Displaying a Commenter’s Gravatar in GraffitiCMS Post Comments

Gravatar is a system that provides for a globally recognized avatar amongst many blogging platforms. By setting up a gravatar, your custom image is automatically posted whenever you comment in a blog post which has support for Gravatar. The image is linked by your email address. The service is free, and allows you to assign images to numerous email addresses. Graffiti CMS has support for Gravatar, and I've implemented it in the comments section of my post.view file. It's simple to do as follows:

Inside the #foreach($comment in $comments) loop, I popped this in (and applied some styling via my style.css file):

$macros.gravatar($comment.Email, $comment.Username, $comment.IPAddress, "%{size ='60'}")

 If the commenter does not have a Gravatar on file, there will be a generic image displayed in that spot. Pretty simple! Have a look at some of the posts on my site that have several comments to see it in action.

kick it on DotNetKicks.com

4 Comments and Trackback(s)

Leave a Reply

 
© Crazeegeekchick.com | Theme design by Dana Coffey | Powered by GraffitiCMS