We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23050
    • 1,842 Posts
    Yes, I have Ditto 1.1... I changed pubDate into date but it outputs the same : Calendar without any links

    Edit : Ok, for those who have the same problem with December 1999, you should add a comma at the end of the lines 35 and 48 in assets/snippets/ditto/formats/json.format.inc.php
    Thanks Kylej for your help !
      • 17677
      • 7 Posts
      Quote from: Perrine at Jan 16, 2007, 07:39 AM

      Yes, I have Ditto 1.1... I changed pubDate into date but it outputs the same : Calendar without any links

      Edit : Ok, for those who have the same problem with December 1999, you should add a comma at the end of the lines 35 and 48 in assets/snippets/ditto/formats/json.format.inc.php
      Thanks Kylej for your help !

      --------------------------

      Perrine - Did you get links to Your calendar when You added those commas? Can you be a bit more spesific about the changes in "json.format.inc.php" ? In my json.format.inc.php those linenumbers are just comments... Did I missed something?

      Anyway - I can see the calendar but without any links.

      This is my debug output:

      --------------------------
      DittoCal Debug Output
      Initial Data from Json

      {
      "title":"blog json output",
      "link":"http://www.modx.santaclausxpress.fi/index.php?id=22",
      "description":"",
      "language":"en",
      "copyright":"SCE TESTING 2006",
      "ttl":"120",
      "entries":[

      ]
      }

      Data after JSON decoding

      stdClass Object
      (
      [title] => blog json output
      [link] => http://www.modx.santaclausxpress.fi/index.php?id=22
      [description] =>
      [language] => en
      [copyright] => SCE TESTING 2006
      [ttl] => 120
      [entries] => Array
      (
      )

      )

      Filter Settings

      Filter Month: 03
      Filter Year: 7
      Day Array for output

      Array
      (
      )

      --------------------------

      0.9.6-RC1
      Firefox for MacOS 2.

      Thank You if someone can help!

      Lumimies
        • 15987
        • 786 Posts
        lumimies,
        Looks like your ditto call is not returning any documents. If it was there would be more things listed after entries. Try loading the json page and see if you get more info, and then try adjusting your ditto call to get some output.
          • 17677
          • 7 Posts
          Hello!

          Ok - My fault.. There was a mistake in Ditto call... I guess it is working now because i now have correct entries listed. But there is still no links in Calendar. Any suggestions?

          Lumimies
            • 23050
            • 1,842 Posts
            I can’t remember in which lines I added commas :/

            In json.format.inc.php from Ditto 2.0, all comas are mentionned in TPL and header. So I don’t understand why it’s still not working.
              • 17677
              • 7 Posts
              Perrine - Does it work for You (with the links)?

              Lumimies
                • 23050
                • 1,842 Posts
                Yes it works. This is the json file :

                <?php
                
                // ---------------------------------------------------
                // JSON Parameters
                // ---------------------------------------------------
                
                $startID= (isset($_REQUEST['startID'])? $_REQUEST['startID']: $startID);
                
                // set json placeholders
                $json_placeholders['[+json_lang+]'] = (isset($language))? $language : $_lang['abbr_lang'];
                $json_placeholders['[+json_copyright+]'] = isset($copyright) ? $copyright:'[(site_name)] 2006';
                $json_placeholders['[+json_link+]'] = $modx->config['site_url']."[~".$modx->documentObject['id']."~]";
                $json_placeholders['[+json_ttl+]'] = isset($ttl) ? intval($ttl):120;
                $json_placeholders['[+json_op+]'] = (!empty($_REQUEST['jsonp']) ? $_REQUEST['jsonp'] : '');
                
                // ---------------------------------------------------
                // 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
                
                $json_tpl = <<<TPL
                	{
                	 "title":"[+json_pagetitle+]",
                	 "link":"[(site_url)][~[+id+]~]",
                	 "date":"[+json_date+]",
                	 "guid":"[(site_url)][~[+id+]~]",
                	 "author":"[+json_author+]",
                	 "description":"[+json_description+]",
                	 "summary":"[+json_summary+]",
                	},
                
                TPL;
                
                $json_tpl_last = <<<TPL
                	{
                	 "title":"[+json_pagetitle+]",
                	 "link":"[(site_url)][~[+id+]~]",
                	 "date":"[+json_date+]",
                	 "guid":"[(site_url)][~[+id+]~]",
                	 "author":"[+json_author+]",
                	 "description":"[+json_description+]",
                	 "summary":"[+json_summary+]",
                	}
                TPL;
                
                $json_footer = <<<TPL
                
                 ]
                }
                TPL;
                
                // ---------------------------------------------------
                // Pass JSON Templates To Snippet
                // ---------------------------------------------------
                
                $header = isset($header) ? $header : $ditto->template->replace($json_placeholders,$json_header);
                
                $tpl = isset($tpl) ? $tpl : "@CODE:".$json_tpl;
                
                $tplLastRow = isset($tplLastRow) ? $tplLastRow : "@CODE:".$json_tpl_last;
                
                $footer = isset($footer) ? $footer : $json_footer;
                
                ?>


                I run a 0.9.5, with Ditto 1.1 and DittoCal 1.1

                And the site where I’m running it : http://www.jauraisduluidire.com
                  • 17677
                  • 7 Posts
                  Thank You for Your help

                  - You file did not work for me.

                  Debug says that:

                  ----------------

                  Filter Settings

                  Filter Month: 66
                  Filter Year: 7230

                  ----------------

                  ... and it gives me December 1969 (with link...) ... So it must be with Dittos filter settings, i think. I`ll try to check those settings..

                  Lumimies
                    • 17673
                    • 194 Posts

                    Hi all, I just upgraded Ditto and DittoCal to the latest versions on a 0.9.5 MODx, here are a few observations.

                    DittoCal 1.2 did not like Ditto 2.0.1 Json output, for the calendar to work I had to use Ditto 2.0.2 SVN.

                    the &id-&landing combo in the DittoCal call do filter the posts day-by-day correctly, but the month on that filtered page is not preserved: for example clicking on Feb 16th gives me 3 articles edited on that date, but the calendar goes back to April (the default, i.e. the month with the newest post); it would be much more logical if february was still displayed.

                    For the $monthlinks array I am using urls such as:
                    http://www.mysite.it/language/News.html?newspage_month=2&newspage_year=2007 (...no newspage_day)
                    these correctly list all posts of the month but suffer from the same mismatch between the posts-dates and the calendar-month described above.
                    The next/previous month links use cal_month cal_year variables in place of newspage_month/year, and thus do not filter the results; clicking them you go back to the full Ditto list of posts. Moreover I don’t see how to manage a multilingual site with a single $monthlinks array, aside from duplicating the Snippet and calling one or the other according to the language chosen.

                    I think it would be much simpler if Dittocal appended newspage_ variables everywhere, and the user can only choose wether to activate the links on the month and on the previous/next arrows with a [0,1] parameter. This way one does not have to remember editing the snippet code to insert new months.
                      ----------------------------------------------------------
                      http://www.linkedin.com/in/lucapost/
                      http://www.twitter.com/lukwe/
                      ----------------------------------------------------------
                      • 4873
                      • 11 Posts
                      I’m using DittoCal (and Ditto) to create and online agenda where people can check past and future activities. To have control on displayed dates I successfully edited

                      /assets/snipets/ditto/formats/json.format.inc.php

                      to switch from the createdon to pub_date dates (lines 88 and 101). I just need to have one last tweak which is to have DittoCal display documents published in future dates. Any one can help?

                      Thanks in advance!

                      (BTW, I’m running Modx 0.9.5, Ditto 2.0.2 and DittoCal 1.2)