Generating events
Last updated Mar 9th, 2021 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn moreExample¶
It is not built-in snippet, it example of snippet for generating events. Save this code as snippet eventsGenerator and you may used it for debugging.
<?php
$year = !empty($_REQUEST['year']) ? $_REQUEST['year'] : date('Y');
$month = !empty($_REQUEST['month']) ? $_REQUEST['month'] : date('n');
$days = date('t', strtotime("$year-$month"));
$start = strtotime("$year-$month-1");
$end = strtotime("$year-$month-$days") + 60*60*23;
$arr = array();
for ($i = 1; $i <= 10; $i++) {
$arr[] = array(
'date' => strftime('%Y-%m-%d %H:%M:%S', rand($start, $end))
,'pagetitle' => 'Testing news '.$i
,'introtext' => 'Lorem ipsum dolar'
);
}
return json_encode($arr);
Usage¶
[[!eventsCalendar2?
&events=`[[!eventsGenerator]]`
]]
See Also¶
- eventsCalendar2.eventsCalendar2
- eventsCalendar2.Generating events
- eventsCalendar2.tplCalendar2
- eventsCalendar2.tplCell2
- eventsCalendar2.tplEvent2
- eventsCalendar2.tplHead2
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn more