ExpressionEngine Add-ons

Calendar:Calendars template tag

The Calendar:Calendars tag displays a list of available calendars and outputs information about each calendar.

{exp:calendar:calendars} content {/exp:calendar:calendars}

Parameters

The following parameters are available for use:

calendar_id=

calendar_id="1|3"

This parameter allows you to display specific calendars by specifying their ID(s). You can hardcode a calendar ID, pass it through an embed, or grab it from the URI. Separate multiples with the pipe character.

calendar_short_name=

calendar_short_name="baseball"

This parameter allows you to display specific calendars by specifying their short name(s). You can hardcode a calendar short name, pass it through an embed, or grab it from the URI. Separate multiples with the pipe character.

limit=

limit="5"

This parameter lets you limit the number of calendars to be displayed.

orderby=

orderby="calendar_name"

This parameter allows you to specify how you want a list of calendars ordered. Options are: calendar_name, calendar_short_name and calendar_id. Works in conjunction with the sort parameter.

paginate=

paginate="both"

This parameter allows you to control where the pagination will display. Options are top, bottom, or both. Used in conjunction with the calendar:paginate variable pair and limit parameter.

site=

site="siteA|siteB|siteC"

If using EE Multiple Site Manager (MSM), you can specify a site short name(s) in this parameter to filter event entries down to that site.

sort=

sort="desc"

This parameter allows you to control whether the results should be asc (ascending) or desc (descending).

Variables

The following variables are available for use:

calendar:name

{calendar:name}

This variable outputs the label of the calendar.

calendar:short_name

{calendar:short_name}

This variable outputs the short name of the calendar.

calendar:id

{calendar:id}

This variable outputs the ID of the calendar.

calendar:description

{calendar:description}

This variable outputs the description for the calendar.

calendar:color

{calendar:color}

This variable outputs the associated colour for the calendar. The value will be the hex code (ex: #FF0000).

calendar:color_light

{calendar:color_light}

This variable outputs a lightened version of the assigned color for the calendar. This would typically be used when setting a background color for calendar lists or flags. Can also be used in conjunction with the calendar:text_color variable.

calendar:text_color

{calendar:text_color}

This variable looks at the lightened version of the assigned calendar color, and outputs a value of black or white, whichever it believes to be better contrasting. This would typically be used when setting a background color for calendar lists or flags. Can also be used in conjunction with the calendar:color_light variable.

calendar:ics_hash

{calendar:ics_hash}

This variable parses as the unique hash value associated with calendar for ICS Subscription functionality. You use this hash value in a URL that matches the location of the template that contains the Calendar:ICS_Subscription template tag, allowing users to subscribe to the whole calendar. To use this feature, you must have ICS Sharing enabled in the control panel for the applicable calendar (click the green icon button in Manage column for the applicable calendar(s) on the list view of calendars in the Calendar control panel).

Variable Pairs

The following variable pairs are available for use:

calendar:member_groups

<ul>
{calendar:member_groups}
    <li>{calendar:member_group_title}</li>
{/calendar:member_groups}
</ul>

This variable pair controls the formatting and displays a list of all member groups that have publishing access for each calendar. The following variables become available for use inside this variable pair: {calendar:member_group_title}, {calendar:member_group_name} and {calendar:member_group_id}.

calendar:paginate

{calendar:paginate}
    <li>
        Page {calendar:current_page} of
        {calendar:total_pages} pages &nbsp;
        {calendar:pagination_links}
    </li>
{/calendar:paginate}

OR

{calendar:paginate}
<ul class="pagination">
    {calendar:pagination_links}
        {first_page}
            <li><a href="{pagination_url}">First</a></li>
        {/first_page}
        {previous_page}
            <li><a href="{pagination_url}">&laquo; Previous</a></li>
        {/previous_page}
        {page}
            <li{if current_page} class="active"{/if}><a href="{pagination_url}">{pagination_page_number}</a></li>
        {/page}
        {next_page}
            <li><a href="{pagination_url}">Next &raquo;</a></li>
        {/next_page}
        {last_page}
            <li><a href="{pagination_url}">Last</a></li>
        {/last_page}
    {/calendar:pagination_links}
</ul>
{/calendar:paginate}

Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with calendar: (except for any variables and variable pairs inside of the calendar:pagination_links variable pair). Used in conjunction with the paginate parameter.

Conditionals

The following conditionals are available for use:

calendar:no_results

{if calendar:no_results}
    Sorry, no calendars exist for the specified parameters.
{/if}

This conditional displays its contents when there is no calendar results for the given parameters.

Examples

The following code example will display a list of all available calendars, or information about a given calendar if there's a short name in the 3rd segment of the URI:

<ul>
{exp:calendar:calendars
    {if segment_3}
        calendar_short_name="{segment_3}"
    {/if}
    limit="10" paginate="both"
}
    <li>
        <a href="{path='calendar/calendars'}/{calendar:short_name}">{calendar:name}</a>
    </li>
    {if calendar:no_results}
        <li>No results found.</li>
    {/if}
    {calendar:paginate}
        <li>
            Page {calendar:current_page} of {calendar:total_pages} pages.
            {calendar:pagination_links}
        </li>
    {/calendar:paginate}
{/exp:calendar:calendars}
</ul>