This extension allows you to display a Gravatar in your view files. Full documented and customizable.
Resources ¶
Documentation ¶
Installation Instructions: ¶
- Download the extension
- Unzip the file contents
- Upload the VGGravatarWidget.php file to the extensions folder located under WebRoot/protected/extensions
- Read Usage Instructions.
Requirements: ¶
This should work on all Yii versions (That has widgets working in them), But was tested on version 1.0.9 & 1.1.x .
Usage: ¶
Inside your view file just paste the following code:
<?php
$this->widget('application.extensions.VGGravatarWidget',
array(
'email' => 'myemail@mydomain.com', // email to display the gravatar belonging to it
'hashed' => false, // if the email provided above is already md5 hashed then set this property to true, defaults to false
'default' => 'http://www.mysite.com/default_gravatar_image.jpg', // if an email is not associated with a gravatar this image will be displayed,
// by default this is omitted so the Blue Gravatar icon will be displayed you can also set this to
// "identicon" "monsterid" and "wavatar" which are default gravatar icons
'size' => 50, // the gravatar icon size in px defaults to 40
'rating' => 'PG', // the Gravatar ratings, Can be G, PG, R, X, Defaults to G
'htmlOptions' => array( 'alt' => 'Gravatar Icon' ), // Html options that will be appended to the image tag
));
?>
Change Log ¶
March 31, 2010 ¶
- Initial release.
Extending gravatar plg
I added a new protected variable for redirect to some url
protected $redirect = '';
and run method add this
if (!empty($this->redirect))
echo CHtml::link(CHtml::image(self::GRAVATAR_URL . $this->url, $this->htmlOptions['alt'], $this->htmlOptions), $this->redirect);
else
echo CHtml::image(self::GRAVATAR_URL . $this->url, $this->htmlOptions['alt'], $this->htmlOptions);
Good Job!!
It will certainly save me some time!!
Thanks!!
:)
failed to open stream: Permission denied ??
Why am I getting an error:
require(G:\xamp\htdocs\test_ug\protected\extensions\VGGravatarWidget.php) [<a href='function.require'>function.require</a>]: failed to open stream: Permission denied
G:\xamp\htdocs\yii\YiiBase.php(319)
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.