We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26310
    • 130 Posts
    Hi,

    I’m trying to setup a BASIC event listing for a client. I’m just using a TV as the event date and sorting by that for upcoming events. The unpublish field takes that document off the list just fine, but how do I go about creating a Ditto call to show all the unpublished entries for use in a past events page? I tried setting &showPublishedOnly=`0` like the docs mentioned but that shows both published and unpublished.

    Do I use reflect for that? What exactly does reflect do? I still can’t wrap my head around that.
      I twitch because I care....and drink too much coffee.
      • 36592
      • 970 Posts
      How about using &filter parameter.
      Possibly...
      &filter=`published,1,2`

      Or
      &filter=`published,0,1`

        • 26310
        • 130 Posts
        I didnt think I could filter by that, I kept trying to filter by unpub day being less than the current date but that wasnt working. Thanks for the tip Ill try it in the morning. Had to give this project a rest tonight; the SIMPLIST things arent working right now tongue
          I twitch because I care....and drink too much coffee.
          • 26310
          • 130 Posts
          I got it working with this parameter:

          &filter=`published,0,1`


          I don’t understand that though. So from what I make of the Ditto Documentation http://ditto.modxcms.com/tutorials/basic_filtering.html

          It’s looking at the published field, then finding anything that’s NOT Un-published??? Isn’t that what MODE 1 means? Do I have this backwards? It’s working none the less I’m just confused.

          Thanks again tkfm!
            I twitch because I care....and drink too much coffee.
            • 36592
            • 970 Posts
            You can filter out the documents which meets the criteria with &filter parameter specifies. I believe Ditto first aggregates documents and filter out those with &filter parameter. Sometimes it’s really confusing when you use multiple conditions like...
            &filter=`MyTV1,new,2|MyTV2,10,3`

            This filters out all the documents with MyTV1 is ’new’ OR MyTV2 is less than ’10’.