Skip to main content

Calendar:Year_List template tag

The Calendar:Year_List loop outputs an archive list of years for the purpose of generating simple lists to link to Year calendars.

{exp:calendar:year_list} content {/exp:calendar:year_list}

Parameters

date_range_start=

date_range_start="2009-01-01"

Limits output to years on or after this date. Both standard and easy-to-use text date formatting apply to this parameter. Default value is year-01-01.

date_range_end=

date_range_end="2012-12-last"

Limits output to years on or before this date. Both standard and easy-to-use text date formatting apply to this parameter.

limit=

limit="5"

This parameter allows you to limit the amount of year results to be displayed in the list. Default is 100.

Variables

year

{year format="%Y"}

Displays the given year, formatted using EE-style format characters. If format="" is not specified, it will parse as YYYY (ex: 2009).

Conditionals

is_current_year

{if is_current_year}Current Year{/if}

If the year in the list of results is the current year, this conditional will display its contents.

is_not_current_year

{if is_not_current_year}NOT Current Year{/if}

If the year in the list of results is NOT the current year, this conditional will display its contents.

Examples

The following code will display a list of years during the period of 2009 - 2012:

<ul>
{exp:calendar:year_list
date_range_start="2009-01-01"
date_range_end="2012-12-last"
limit="100"
}
<li>
<a href="{path='calendar/year'}/{year format="%Y"}/">
{year format="%Y"}
</a>
</li>
{/exp:calendar:year_list}
</ul>