Using TYPOlight version 2.7:
Here’s a simple code on how to add gravatar to TYPOlight’s news comment:

Copy the the default comment template –>com_default.tpl [mysite/system/modules/comments/templates/com_default.tpl], open the editor and then add these lines

<?php
$default = ""; // link to your default avatar
$size = 48; // image size in pixels squared
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5( strtolower($this->email) )."&default=" . urlencode($default) . "&size=" . $size;
?>
<div class="gravatar"><img src="<?=$grav_url ?>" height="<?=$size ?>" width="<?=$size ?>" alt="User Gravatar" /></div><div class="comment_default<?php echo $this->class; ?>" id="<?php echo $this->id; ?>">
<p class="info"><?php echo $this->by; ?> <?php if ($this->website): ?><a href="<?php echo $this->website; ?>" onclick="window.open(this.href); return false;"><?php endif; echo $this->name; ?><?php if ($this->website): ?></a><?php endif; ?><span class="date"> | <?php echo $this->date; ?></span></p>
<div class="comment">
<?php echo $this->comment; ?>
</div>
</div>

Use CSS to float left or right of your gravatar

.gravatar {
float: left;}

Advertisements