Skip to content

Instantly share code, notes, and snippets.

@davist11
Created January 10, 2011 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davist11/772910 to your computer and use it in GitHub Desktop.
Save davist11/772910 to your computer and use it in GitHub Desktop.
ExpressionEngine Mini Calendar
{preload_replace:channel="blog"}
{exp:channel:calendar channel="{channel}"
show_future_entries="no" display_by="day"}
<div class="content">
<h3>{date format="%F %Y"}</h3>
<ul class="nav-calendar">
<?php if('{date format="%Y"}' == '2007') : ?>
<?php if ('{date format="%n"}' > '1') : ?>
<li class="prev">
<a href="{previous_path='{channel}/calendar'}">
&larr;
</a>
</li>
<?php endif; ?>
<?php else : ?>
<li class="prev">
<a href="{previous_path='{channel}/calendar'}">
&larr;
</a>
</li>
<?php endif; ?>
<?php if('{date format="%Y"}' == date('Y')) : ?>
<?php if ('{date format="%n"}' < date('n')) : ?>
<li class="next">
<a href="{next_path='{channel}/calendar'}">
&rarr;
</a>
</li>
<?php endif; ?>
<?php else : ?>
<li class="next">
<a href="{next_path='{channel}/calendar'}">
&rarr;
</a>
</li>
<?php endif; ?>
</ul>
<table border="0" cellpadding="0" cellspacing="0">
<thead>
<tr>
{calendar_heading}
<th>{lang:weekday_abrev}</th>
{/calendar_heading}
</tr>
</thead>
{calendar_rows }
{row_start}<tr>{/row_start}
{if entries}
<?php $count = 1; ?>
{entries}
<?php if ($count == 1) : ?>
<td>
<a href="{url_title_path='{channel}'}">
{day_number}
</a>
</td>
<?php $count++; ?>
<?php endif; ?>
{/entries}
{/if}
{if not_entries}
<td>{day_number}</td>
{/if}
{if blank}
<td>&nbsp;</td>
{/if}
{row_end}</tr>{/row_end}
{/calendar_rows}
</table>
</div>
{/exp:channel:calendar}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment