Created
January 15, 2016 23:28
-
-
Save a-am/ce8efcd50bab2c704e84 to your computer and use it in GitHub Desktop.
Venti's default calendar output for quick calendars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Getting the current month or year if no month or year are passed as url params #} | |
{% set currentMonth = craft.request.getParam('m') ? craft.request.getParam('m') : "now"|date('n') %} | |
{% set currentYear = craft.request.getParam('y') ? craft.request.getParam('y') : "now"|date('Y') %} | |
{# Getting the first day of the currentMonth & currentYear for point of refrence to obtain next month and next year #} | |
{% set cur = currentYear ~ "-" ~ currentMonth ~ "-1" %} | |
{% set prevMonth = cur|date_modify("last day of last month")|date('U') %} | |
{% set nextMonth = cur|date_modify("first day of next month")|date('U') %} | |
{# Obtaining the events for the calendar #} | |
{% set events = craft.venti.allEvents().startDate('and', '>= ' ~ prevMonth, '<= ' ~ nextMonth).find() %} | |
{% set cal = craft.venti.getCal(events,currentMonth,currentYear) %} | |
{# Output of the calendar #} | |
<div class="table-box"> | |
{{ cal|raw }} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment