示例#1
0
<?php

require '../calendar.php';
date_default_timezone_set('UTC');
setlocale(LC_ALL, 'en_US');
// get the year and number of week from the query string and sanitize it
$year = filter_input(INPUT_GET, 'year', FILTER_VALIDATE_INT);
$month = filter_input(INPUT_GET, 'month', FILTER_VALIDATE_INT);
// initialize the calendar object
$calendar = new calendar();
// get the current month object by year and number of month
$currentMonth = $calendar->month($year, $month);
// get the previous and next month for pagination
$prevMonth = $currentMonth->prev();
$nextMonth = $currentMonth->next();
// generate the URLs for pagination
$prevMonthURL = sprintf('?year=%s&month=%s', $prevMonth->year()->int(), $prevMonth->int());
$nextMonthURL = sprintf('?year=%s&month=%s', $nextMonth->year()->int(), $nextMonth->int());
// set the active tab for the header
$activeTab = 'month';
require '../assets/snippets/header.php';
?>

<section class="month">

  <h1>
    <a class="arrow" href="<?php 
echo $prevMonthURL;
?>
">&larr;</a> 
    <?php