We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    I'm building a site with an ditto overview of some events.
    Below the program there is an archive.

    When an event is finished it needs to go to the archive list automaticly.
    How can I do this with ditto?

    Should I set unpublished date in the resource and use 2 ditto calls?
    One with show published only and one with show unplublished only? (if possible)

    Or is there a better way to do this?

    This question has been answered by multiple community members. See the first response.

    [ed. note: fourroses666 last edited this post 9 years, 6 months ago.]
      Evolution user, I like the back-end speed and simplicity smiley
      • 9995
      • 1,613 Posts
      Or do i need to use Reflect for this?
      I rather don't unpublish pages, on the other hand, I don't care too much.
      If its the easiest way to do this.

      [ed. note: fourroses666 last edited this post 9 years, 6 months ago.]
        Evolution user, I like the back-end speed and simplicity smiley
        • 16278
        • 928 Posts
        If you don't want to make pages unavailable, it would be better not to unpublish them. I think Reflect is an unfinished piece of work - too complicated to set up, too unclear in how it operates.

        How about using a specific date TV e.g. "archive-date" and two Ditto calls with complementary filters to compare this against today's date? NB the TV will need a default value way in the future to avoid a null value being read as past the archiving date. Most documentation on filter rules 5 & 6 is back to front. In fact, 5 means "is greater than or equal to the criterion (>=)" and 6 means "is less than or equal to the criterion (<=)"

        Something like:
        <h3>Live</h3>
        [!Ditto? &id=`current`
        &parents=`2`
        &filter=`archive-date,@EVAL return time();,5`
        !]
        
        <h3>Archived</h3>
        [!Ditto? &id=`archived`
        &parents=`2`
        &filter=`archive-date,@EVAL return time();,3`
        !]
        

        :) KP
          • 9995
          • 1,613 Posts
          Thanks allot KP, gona test this!
            Evolution user, I like the back-end speed and simplicity smiley
            • 9995
            • 1,613 Posts
            Tested but it isn't archiving sad
            The 2013 one is still in current/live.
            Any idea whats wrong? id= can be ignored?

            Not archived call:
            [!Ditto? 
            &id=`current`
            &parents=`4`
            &filter=`archive-date,@EVAL return time();,5`
            &total=`99`
            &showPublishedOnly=`1`
            &orderBy=`menuindex ASC`
            &noResults=`Geen berichten..`
            &tpl=`programma-detail`
            !]


            Archived call:
            [!Ditto?
            &id=`archived`
            &parents=`4`
            &filter=`archive-date,@EVAL return time();,3`
            &total=`99`
            &showPublishedOnly=`1`
            &orderBy=`menuindex ASC`
            &noResults=`Geen berichten..`
            &tpl=`programma-detail`
            !]



            Result:

            Not archived call:

            Not archived
            Date: 28-10-2015 12:59:00

            YES Archived
            Date: 16-10-2013 13:00:00

            Archived call:
            Geen berichten..
              Evolution user, I like the back-end speed and simplicity smiley
              • 9995
              • 1,613 Posts
              Tried .time() but then both are archived.
              Also tried @EVAL return .date(); no luck

              http://rtfm.modx.com/evolution/1.0/developers-guide/template-variables/%28at%29-binding/%28at%29eval

              http://forums.modx.com/thread/41530/solved-filtering-by-current-date-timestamp?page=2#dis-post-240856

              is the mode correct? 5 and 3?
              http://www.pogwatch.com/ditto/ditto-filters.html [ed. note: fourroses666 last edited this post 9 years, 6 months ago.]
                Evolution user, I like the back-end speed and simplicity smiley
                • 9995
                • 1,613 Posts
                I have no clue how to solve this, I really suck at this.

                Maybe I can use unpublishdate -1 year?

                how would that look like? [ed. note: fourroses666 last edited this post 9 years, 6 months ago.]
                  Evolution user, I like the back-end speed and simplicity smiley
                  • 9995
                  • 1,613 Posts
                  Can't find any placeholders for unpublished date sad
                  [+unpublishedon+] doesn't do anything.

                  Is it possible to use publish or unpublish date in Ditto??

                  then I could maybe use something like this?
                  @EVAL return strtotime('-1 year');

                  [ed. note: fourroses666 last edited this post 9 years, 6 months ago.]
                    Evolution user, I like the back-end speed and simplicity smiley
                  • discuss.answer
                    • 9995
                    • 1,613 Posts
                    I'm thinking of duplicating all events and use the publish and unpublish date sad

                    Also tried to do this with javascript, add a class when the date/time is in the past or future based on the current time.
                    But I'm a bad coder and didn't found any usefull examples.
                      Evolution user, I like the back-end speed and simplicity smiley
                    • discuss.answer
                      • 16278
                      • 928 Posts
                      Does the archive-date TV have the unixtime widget? Otherwise you'll be comparing a number with text. I forgot to mention that before.

                      The setup worked for me, using a test page on my local copy of Pogwatch.

                      The documentation on Pogwatch was not correct re modes 5 & 6. I have now updated it, reflecting what I found out when documenting List, Clipper's version of Ditto. I tend to use those pages for reference for both Clipper and Evo (including the API) these days, as I did some checking against the code while writing them.

                      The document variable for the unpublish date field is unpub_date.

                      ;) KP