Retired Documentation: You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.
Calendar Tag
This tag allows you to display a calendar which contains links based on entries in your weblog. Here is an example of what you might use for a "mini-calendar" that you could place on each page of your site:
{exp:weblog:calendar switch="calendarToday|calendarCell"}
<table class="calendarBG" border="0" cellpadding="6" cellspacing="1" summary="My Calendar">
<tr class="calendarHeader">
<th><div class="calendarMonthLinks"><a href="{previous_path='weblog/index'}"><<</a></div></th>
<th colspan="5">{date format="%F %Y"}</th>
<th><div class="calendarMonthLinks"><a class="calendarMonthLinks" href="{next_path='weblog/index'}">>></a></div></th>
</tr>
<tr>
{calendar_heading}
<td class="calendarDayHeading">{lang:weekday_abrev}</td>
{/calendar_heading}
</tr>
{calendar_rows }
{row_start}<tr>{/row_start}
{if entries}
<td class='{switch}' align='center'><a href="{day_path='weblog/index'}">{day_number}</a></td>
{/if}
{if not_entries}
<td class='{switch}' align='center'>{day_number}</td>
{/if}
{if blank}
<td class='calendarBlank'>{day_number}</td>
{/if}
{row_end}</tr>{/row_end}
{/calendar_rows}
</table>
{/exp:weblog:calendar}
Here is an example of what you might use for a "big" calendar that listed all entries on each day:
{exp:weblog:calendar switch="calendarToday|calendarCell" weblog="default_site"}
<table class="calendarBG" border="0" cellpadding="6" cellspacing="1" summary="My Calendar" width="90%">
<tr class="calendarHeader">
<th><div class="calendarMonthLinks"><a href="{previous_path='weblog/cal'}"><<</a></div></th>
<th colspan="5">{date format="%F %Y"}</th>
<th><div class="calendarMonthLinks"><a class="calendarMonthLinks" href="{next_path='weblog/cal'}">>></a></div></th>
</tr>
<tr>
{calendar_heading}
<td class="calendarDayHeading">{lang:weekday_abrev}</td>
{/calendar_heading}
</tr>
{calendar_rows }
{row_start}<tr>{/row_start}
{if entries}
<td class='{switch}' align='center'>
<a href="{day_path='weblog/index'}">{day_number}</a>
{entries}
<div><a href="{title_permalink='weblog/index'}">{title}</a> <a href="{profile_path='member/profile'}">{author}</a></div>
{/entries}
</td>
{/if}
{if not_entries}
<td class='{switch}' align='center'>{day_number}</td>
{/if}
{if blank}
<td class='calendarBlank'>{day_number}</td>
{/if}
{row_end}</tr>{/row_end}
{/calendar_rows}
</table>
{/exp:weblog:calendar}
You may also view the example CSS to go along with the calendar examples. You can add this to your main stylesheet if you wish, modify it as needed, or simply ignore it.
Parameters
Most of the Parameters of the standard {exp:weblog:entries} tag are available. In addition, the following are special to the weblog calendar tag.
- leading_zeroes="yes"
- month="04" year="2002"
- show_future_entries="yes"
- start_day="sunday"
- switch="calendarToday|calendarCell"
Note: Dynamic Parameters may not be used with the calendar tag.
leading_zeroes=
leading_zeroes="yes"
Setting this parameter to "yes" will display the {day_number} variable as a two-digit, zero-padded number, e.g.: 01, 02, 03, etc. The default setting is "no."
month= year=
month="04" year="2002"
You may hardcode the month and year to display for the calendar. You must specify both the month and year. The month should be specified in numerical form.
show_future_entries=
show_future_entries="yes"
You can determine whether you wish for entries dated in the "future" to be included. This option is useful when doing things like creating a list of events, some of which have not occurred yet.
start_day=
start_day="sunday"
You may define the day of the week on which your week starts. Available values:
- sunday
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
switch=
switch="calendarToday|calendarCell"
This parameter works differently than the one available in the weblog entries tag. This parameter lets you define two states: the "today" state and "all other" states. Typically, this is used to define two CSS classes which are applied to the table cell holding the day of the month. If the cell corresponds to today's date then the "today" state (the first state) is applied, otherwise the "all others" state (the second state) is applied.
This works together with the {switch} variable.
Variable Pairs
- {calendar_heading} {/calendar_heading}
- {calendar_rows} {/calendar_rows}
- {entries} {/entries}
- {row_end} {/row_end}
- {row_start} {/row_start}
calendar_heading
{calendar_heading}
<td class="calendarDayHeading">{lang:weekday_abrev}</td>
{/calendar_heading}
This variable pair is used to create the table row showing the days of the week. You can use one of three variables to determine what is shown for the day:
- {lang:weekday_abrev}: The one-letter abbreviation for the day of the week. i.e. M, T, etc.
- {lang:weekday_long}: The full-text for the day of the week. i.e. Monday, Tuesday, etc.
- {lang:weekday_short}: The short-text for the day of the week. i.e. Mon, Tue, etc.
Using these variables will allow the calendar to display the day names in the appropriate language for the user. If they have a language specified in their profile then the system will use that, otherwise it will use the default language specified in the Control Panel.
calendar_rows
{calendar_rows}
{row_start}<tr>{/row_start}
<td class='{switch}' align='center'>
<a href="{day_path='weblog/index'}">{day_number}</a>
{entries}
<div><a href="{title_permalink='weblog/index'}">{title}</a> <a href="{profile_path='member/profile'}">{author}</a></div>
{/entries}
</td>
{row_end}</tr>{/row_end}
{/calendar_rows}
This variable pair is used to create the rows of dates for the calendar.
entries
{entries}
<div><a href="{title_permalink='weblog/index'}">{title}</a> <a href="{profile_path='member/profile'}">{author}</a></div>
{/entries}
This variable pair will loop through entries in the specified weblog(s) that occur on that date.
row_end
{row_end}</tr>{/row_end}
This variable pair simply defines what content to use at the end of a row.
row_start
{row_start}<tr>{/row_start}
This variable pair simply defines what content to use at the start of a row.
Single Variables
- {author}
- {comment_auto_path}
- {comment_entry_id_auto_path}
- {comment_path='weblog/comments'}
- {comment_url_title_auto_path}
- {comment_tb_total}
- {comment_total}
- {date format="%F %Y"}
- {day_number}
- {day_path='weblog/index'}
- {entry_id_path='weblog/comments'}
- {next_date format="%m %Y"}
- {next_path='weblog/calendar'}
- {permalink=weblog/archives}
- {previous_date format="%m %Y"}
- {previous_path='weblog/calendar'}
- {profile_path='member/profile'}
- {switch}
- {title}
- {title_permalink=weblog/archives}
- {trackback_path='weblog/trackbacks'}
- {trackback_total}
- {url_title_path='weblog/archives'}
author
{author}
The author's screen name, if it exists; otherwise, this variable will display the username. This is used inside the {entries}{/entries} variable pair.
comment_auto_path
{comment_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. No entry id, URL Title, or other information is included; this is the exact URL from the preference.
comment_entry_id_auto_path
{comment_entry_id_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. The ID number of the entry will be automatically added. For example, this:
<a href="{comment_entry_id_auto_path}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/234/">my entry</a>
comment_url_title_auto_path
{comment_url_title_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. The URL Title of the entry will be automatically added. For example, this:
<a href="{comment_url_title_auto_path}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/ice_cream/">my entry</a>
comment_path
{comment_path='weblog/comments'}
The URL to the specified template. The ID number of the entry will be automatically added. For example, this:
<a href="{comment_path='weblog/comments'}">comments</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/234/">comments</a>
This is only available for use inside the {entries}{/entries} variable pair.
comment_tb_total
{comment_tb_total}
The combined total number of both comments and trackbacks for a particular entry. This is used inside the {entries}{/entries} variable pair.
comment_total
{comment_total}
The total number of comments for a particular entry. This is used inside the {entries}{/entries} variable pair.
date
{date format="%F %Y"}
The current date. As with other date variables, this require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.
day_number
{day_number}
The number of the day of the month.
day_path
{day_path='weblog/index'}
This variable will be replaced by a URL designed to show all entries from the specified day. Typically, the path should be for your main Template that shows your multiple entries. For example, this:
<a href="{day_path='weblog/index'}">{day_number}
Might be rendered like this:
<a href="http://example.com/index.php/weblog/2003/02/17/">17</a>
entry_id_path
{entry_id_path='weblog/comments'}
The URL to the specified template. The ID number of the entry will be automatically added. For example, this:
<a href="{entry_id_path='weblog/comments'}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/234/">my entry</a>
This is only available for use inside the {entries}{/entries} variable pair.
next_date
{next_date format="%m %Y"}
The next date for the calendar; i.e. the next month. As with other date variables, this require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.
next_path
{next_path='weblog/calendar'}
This variable will be replaced by a URL designed to point to the next month on the calendar. Typically, the path should be to the current calendar page.
permalink
{permalink}
This variable defaults to site index with entry ID number:
http://example.com/235/
In addition, you can specify a template group/template and the entry ID will automatically be added:
{permalink="weblog/archives"}
Will render as:
http://example.com/weblog/archives/235/
This is only available for use inside the {entries}{/entries} variable pair.
previous_date
{previous_date format="%m %Y"}
The previous date for the calendar; i.e. the previous month. As with other date variables, this require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.
previous_path
{previous_path='weblog/calendar'}
This variable will be replaced by a URL designed to point to the previous month on the calendar. Typically, the path should be to the current calendar page.
profile_path
{profile_path='member/profile'}
The URL to the author of the current entry. This is used inside the {entries}{/entries} variable pair. The ID number of the author will be automatically added. Use in a link:
<a href="{profile_path='member/profile'}">{author}</a>
This is only available for use inside the {entries}{/entries} variable pair.
switch
{switch}
This variable permits you to alternate between any two values as the entries are displayed. This variable works together with the switch= parameter.
title
{title}
The title of the entry. This is used inside the {entries}{/entries} variable pair.
title_permalink
{title_permalink}
This variable uses the "url title" as the link. It defaults to the site index with the "url title":
http://example.com/my_ugly_boyfriend/
In addition, you can specify a specific template group/template and the "url title" will automatically be added:
{title_permalink="weblog/archives"}
Will render as:
http://example.com/weblog/archives/my_ugly_boyfriend/
Note: When creating a new entry, if you don't supply the "url title" then it will be automatically created from the actual entry title. Spaces are turned into underscores and quotes are removed. For example, "Joe's night out" becomes "joes_night_out".
This is only available for use inside the {entries}{/entries} variable pair.
trackback_path
{trackback_path='weblog/comments'}
The URL to the specified template. The ID number of the entry will be automatically added. Use in a link:
<a href="{trackback_path='weblog/comments'}">trackback</a>
This is only available for use inside the {entries}{/entries} variable pair.
trackback_total
{trackback_total}
The total number of trackbacks for a particular entry. This is used inside the {entries}{/entries} variable pair.
url_title_path
{url_title_path='weblog/archives'}
The URL to the specified template. The "url title" of the entry will be automatically added. For example, this:
<a href="{url_title_path='weblog/archives'}">permalink</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/archives/ice_cream/">permalink</a>
This is only available for use inside the {entries}{/entries} variable pair.