1. Go to this page and download the library: Download rundiz/thai-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/ */
rundiz / thai-calendar example snippets
// If you did not install it via Composer, you have to include/diz' . DIRECTORY_SEPARATOR . 'Calendar' . DIRECTORY_SEPARATOR . 'Calendar.php';
IRECTORY_SEPARATOR . 'GeneratorAbstractClass.php';
// The files below is calendar HTML generator. Choose just only one.
ther date/month/year in the same page.
$Calendar->base_url = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Set the viewing date to let calendar component knows that what is currently date you are looking at.
$Calendar->viewing_date = (isset($_GET['viewdate']) ? strip_tags($_GET['viewdate']) : date('Y-m-d'));
// Set first day of the week. You can ignore this property because it is set to 0 (Sunday) by default. Set to 0 for Sunday, 1 for Monday to 6 for Saturday.
$Calendar->first_day_of_week = 1;
// Display the calendar.
// The first argument in this method is scope. You can set to 'day', 'week', 'month', 'year'.
// The second argument is the generator class name in case that you want something different.
echo $Calendar->display('day');
// Call to clear to clear and reset everything and make it ready to begins again.
$Calendar->clear();
$Calendar = new \Rundiz\Calendar\Calendar();
$Calendar->base_url = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$Calendar->viewing_date = (isset($_GET['viewdate']) ? strip_tags($_GET['viewdate']) : date('Y-m-d'));
// We already have 2 generators for you to use. 1 is Simple and 2 is Bootstrap3. Use its class name in second argument of display() method.
echo $Calendar->display('year', '\\Rundiz\\Calendar\\Generators\\Bootstrap3');
$Calendar->clear();
// Assume that today is 2016-05-02.
$events = array (
array (
'date_from' => '2016-05-02 00:00:00',
'date_to' => '2016-05-03 01:00:00',
'title' => 'Event today to tomorrow +1hr.',
),
array (
'date_from' => '2016-05-02 00:50:00',
'date_to' => '2016-05-04 16:00:00',
'title' => 'Event today to after tomorrow 00:50 to 16:00.',
),
'special_event1' => array (
'date_from' => '2016-05-03 10:00:00',
'date_to' => '2016-05-03 15:00:00',
'title' => 'Event tomorrow with special key name',
),
array (
'date_from' => '2016-05-03 11:00:00',
'date_to' => '2016-05-03 15:00:00',
'title' => 'Event tomorrow 11:00 to 15:00',
),
array (
'date_from' => '2016-05-03 23:40:00',
'date_to' => '2016-05-04 02:30:00',
'title' => 'Event tomorrow to after tomorrow 23:40 to 02:30',
),
array (
'date_from' => '2016-05-04 08:00:00',
'date_to' => '2016-05-04 23:59:00',
'title' => 'Event after tomorrow 08:00 to 23:59',
),
array (
'date_from' => '2016-05-14',
'date_to' => '2016-05-14',
'title' => 'Event next 12 days',
),
array (
'date_from' => '2016-05-28',
'date_to' => '2016-06-02',
'title' => 'Event 28 this month to next 5 days',
),
) ;
$Calendar->first_day_of_week = 3;// Wednesday as firstday of week.
$Calendar->use_buddhist_era = true;// Set to false for not to use Buddhist era.
$Calendar->buddhist_era_offset = 543;
$Calendar->buddhist_era_offset_short = 43;// 2016 = 2559, 16 = 59.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.