I need DittoCal as a Agenda, so i hacked into the Json.format.inc code and add a variable that i called DataEvento, this variable is also a template variable with the field Date.
It looks something like:
// JSON Templates
// ---------------------------------------------------
$json_header = ’
[+json_op+]{
"title":"[*pagetitle*]",
"link":"[+json_link+]",
"description":"[*description*]",
"language":"[+json_lang+]",
"copyright":"[+json_copyright+]",
"ttl":"[+json_ttl+]",
"entries":[
’;
// not heredoc because { cannont be used as a char in heredoc
//Acrescentado DataEvento!
$json_tpl = <<<TPL
{
"title":"[+json_pagetitle+]",
"link":"[(site_url)][~[+id+]~]",
"date":"[+json_createdon+]",
"guid":"[(site_url)][~[+id+]~]",
"author":"[+json_author+]",
"description":"[+json_description+]",
"introtext":"[+json_introtext+]",
"dataEvento":"[+DataEvento+]",
},
TPL;
From this moment the variable apears on debug mode.
Then on the snippet of DittoCal i changed:
//Filter out posts that are not in the specified month & year, set the link
if (is_array($postData->entries)) {
foreach($postData->entries as $n => $v) {
$debugOutput .=’Ev:’. $v->dataEvento;
$vTimeTemp = strtotime($v->dataEvento);
$vTimestamp = getDate($vTimeTemp);
$debugOutput .= ’Dia:’. $vTimestamp[mday]. ’
’;
$vTimeTemp is converted to unix format and it works fine!
I am getting the posts ok, but i need a tip of what or where i need to do to allow more than one post in the same day.
What king of link will i pass to the code so i can list more than one post for the same day.
Many thanks.
I think that one event per day is DittoCal main shortcoming...
I switched to using EasyEvents for multi-events.
There are some mentions in the long DittoCal thread of using
&landing to be able to do multi-events, but I never found out
how to do it...
good luck!
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
Hi thanks for this. It was really important that i could use ditto cal for an agenda as i was designing a site for a club and they needed to post future events. Your post was really useful. For anyone else attempting to do this you have to include a couple of lines of code from the original snippet that arent listed here:
change
//Filter out posts that are not in the specified month & year, set the link
if (is_array($postData->entries)) {
foreach($postData->entries as $n => $v) {
$vTimestamp = getDate($v->date);
$checkMonth = $vTimestamp["mon"];
$checkYear = $vTimestamp["year"];
to
if (is_array($postData->entries)) {
foreach($postData->entries as $n => $v) {
$debugOutput .=’Ev:’. $v->dataEvento;
$vTimeTemp = strtotime($v->dataEvento);
$vTimestamp = getDate($vTimeTemp);
$debugOutput .= ’Dia:’. $vTimestamp[mday]. ’
’;
$checkMonth = $vTimestamp["mon"];
$checkYear = $vTimestamp["year"];
If anyone knows how to list multiple posts that would be useful. They do show up in debug mode but can link to them from the calender. However if your listing events you can list them like:
23rd march:
EVENT 1
EVENT 2
EVENT 3
I’ll have to explain this to the person im developing the site for