1. Go to this page and download the library: Download scortes/calendar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
scortes / calendar example snippets
// configure calendar
$request = new \Scortes\Calendar\CalendarRequest();
$request->dateStart = new DateTime('now - 2 month');
$request->dateEnd = null; // use max date from events
$request->events = [
"now - 1 month" => 'Day in previous month',
date('Y-n-') . 1 => 'First day in month',
date('Y-n-') . 16 => '16th day in month',
"now + 1 month" => 'Day in next month',
];
$request->addEvent(new DateTime('now + 2 months'), 'now + 2 months');
// build calendar
$calendar = Scortes\Calendar\createCalendar($request);
// display calendar
\Scortes\Calendar\HTML\monthsToTables(
$calendar,
array(
'hideMonthsWithoutEvent' => true,
'selectors' => array(
'table' => ' class=calendar',
'month' => ' id=currentMonth',
'week' => ' id=currentWeek',
'day' => ' id=today',
),
'monthName' => function (Scortes\Calendar\Month\Month $month, $monthId) {
return "<h3{$monthId}>Month {$month->monthNumber}/{$month->year}</h3>";
},
'day' => array(
'withEvent' => function ($event, $currentDay) {
return "<strong title='{$event}'>{$currentDay}</strong>";
},
'withoutEvent' => function ($currentDay) {
return "<strong>{$currentDay}</strong>";
},
'empty' => '<td class="noDay"> </td>'
)
)
);
$dateStart = new DateTime('now - 1 month');
$dateEnd = new DateTime('now + 2 months');
$months = \Scortes\Calendar\createMonthsInterval($dateStart, $dateEnd);
$events = new \Scortes\Calendar\Events\Events(' ');
$events->set('John', 'John');
$events->set('John Doe', 'John Doe');
$events->set('John Black', 'John Black');
$events->set('John Black', 'Another John Black');
$events->set('Paul Carter', 'Paul Carter');
$events->get('John Doe'); // John Doe
$events->get('John Black'); // [John Black, Another John Black]
$events->iterate('John'); // [John, John Doe, [John Black, Another John Black]]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.