Generates simple calendars inside your Twig templates
<?php
// assuming that $twig is the \Twig_Environment instance
$factory = new CalendR\Calendar;
$twig->addExtension(new CalendR\Extension\Twig\CalendRExtension($factory));
Note : If you are a Symfony2 or Silex user, with TwigBundle/TwigServiceProvider available, the CalendR extension is automatically registered.
calendr_year()
: return an instance of yearcalendr_month()
: return an instance of monthcalendr_week()
: return an instance of weekcalendr_day()
: return an instance of daycalendr_events()
: return events for a period{% set week = calendr_week(2012, 14) %}
{% set events = calendr_events(week) %}
<h1>Events for week #{{ week }}</h1>
{% for day in week %}
<h2>{{ day }}</h2>
<ul>
{% for event in events.find(day) %}
<li>{{ event }}</li>
{% endfor %}
</ul>
{% endfor %}
Warning : Most of time, you'd better to retrieve your time period and events inside your controller