Basic Usage

Single Tag and Tag Pairs

There are essentially two ways to use the plugin: as a single tag or a tag pair.

Single Tag

The single tag syntax does not have a closing tag. This will just return the Gravatar URL. It can be used like this:

<img src="{exp:ce_gravatar:single email='software@causingeffect.com'}" alt="" />

Tag Pair

The tag pair syntax has a closing tag. This allows you to pass in tag data (the data between the opening and closing tags) to customize your HTML output.

The only time that using the tag pair syntax is advantageous, is when the default parameter is set to 404, as it will allow you to run a conditional to see if an avatar exists for a particular email address.

{exp:ce_gravatar:pair email="software@causingeffect.com" default="404"}
    {if gravatar}
        {!-- a Gravatar image exists for the provided email address --}
        <img src="{gravatar}" alt="" />
    {if:else}
        {!-- no Gravatar, so let's create our own default image --}
        {exp:ce_img:single src="/images/example/cow_square.jpg" max="80"}
    {/if}
{/exp:ce_gravatar:pair}

Parameters

The parameters are the plugin tag attributes that allow you to alter the plugin’s behavior. All paramaters (listed below), are optional. The different parameters may be applied simultaneously to achieve the desired outcome.

Variables

Variables are placeholders for where the plugin should output a specific value. There is currently only one variable for CE Gravatar.