We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1841
    • 141 Posts
    The Archive style I am trying to use is giving an actual date, like "January 2010" for example, but whenever I try this it doesn't work, simply showing every page published.
      • 1841
      • 141 Posts
      This is the code I am using after creating the suggested "time" snippet:

      [[!getResources?parents=`3` &depth=`3` &hideContainers=`1` &limit=`all` &tpl=`free` &showHidden=`1` &processTVs=`1` &includeTVs=`1` &includeContent=`1` &sortBy=`pagetitle` &sortdir=`ASC` &where=`{ "publishedon:>" : [[!time? &input=`January 2010`]] } ]]


      No Matter what I change it just outputs all resources and seems to completely ignore the "&where" statement.

      I am running Modx 2.2.0-pl2 and the latest getResources version (1.42). This is running on a Linux server with PHP 5.3.8 and MySql 5.08.

      Any help would be really appreciated, it's really doing my head in!
        • 22303 MODX Staff
        • 10,725 Posts
        What does just
        [[!time? &input=`January 2010`]]
        output on your page?
          • 1841
          • 141 Posts
          It seems to completely ignore it and just outputs everything, regardless of what date I use.
            • 37377
            • 64 Posts
            Opengeek means the output of the snippet without the getResources to see what time it returns.

            If you want to show only the items from January 2010 you need to change your where statement to something like:
             &where=`{ "publishedon:>=" : [[time? &input=`1 January 2010`]],"AND:publishedon:<=" : [[time? &input=`31 January 2010`]]  }`
              • 1841
              • 141 Posts
              Sorry for the confusion OpenGeek and thank you very much Culd, that works perfectly now.

              Again thank you very much!
                • 3866 ☆ A M B ☆
                • 350 Posts
                This seems promising - what if you want to use &input= todays date? I want to ensure that resources that are being sorted by an unpublish date and subsequently being called by &showUnpublished property are not called because they are past todays date.

                The &where property seems to be the answer but I can't seem to get todays date to call.

                I have this snippet being used as part of MIGX in a getImageList call:

                &where={"date:>" : "[[!strftime? &format=`%d-%m-%Y`]]"} 


                Snippet code:
                <?php
                return strftime($format);


                I tried to use this snippet like this:
                 [[getResources? &tpl=`monthlyCalendar` &sortby=`unpub_date`  &where=`{"unpub_date": "[[!strftime? &format=`%d-%m-%Y`]]"}` &showUnpublished=`1`  &sortdir=`asc` &includeContent=`1` &includeTVs=`1` &processTVs=`1` &showHidden=`1` &limit=`12` ]]    
                


                but no joy - any other suggests?



                  Helen Warner
                  Number one pixel!
                  Proud to be linked with MODX at Crimson Pixel
                  • 37377
                  • 64 Posts
                  If you add
                  &debug=`1`
                  to your snippet call and check your error log what it says.

                  You also need to add
                  :>=
                  or := to your where statement

                  And finally, I think you're using the wrong format, you shoud change your strftime snippet to :

                  strtotime($input) 

                  and use it like this:
                   [[!time? &input=`now`]]