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

    The following instruction doesn’t work and sends a page without the content (template ok but resource empty):
    [[!getResources? &parents=`6` &tpl=`news` &tvFilters=`news_category==Project`]]

    when I take the tvFilters instruction it works fine (without the filter).
    And if I take the ! out it works fine too (without updating the list on the different pages).

    Anyone has a clue of what’s happening?

    Thanks,

    Thierry
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Does your news_category tv have a value of Project on any of your resources?

      As for the caching, I’d advise against using something that gets a lot of data like that uncached. If you want to make sure it shows the last news, just clear cache after posting something new. (Which it does by default, if I’m not mistaken.)

        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 29861
        • 59 Posts
        Does your news_category tv have a value of Project on any of your resources?
        Yes, anyway the instruction fails and the other parts of the resource are blanked too.


        As for the caching, I’d advise against using something that gets a lot of data like that uncached. If you want to make sure it shows the last news, just clear cache after posting something new. (Which it does by default, if I’m not mistaken.)

        Actually my instruction is:
        [[!getResources? &parents=`6` &tpl=`news` &tvFilters=`news_category==[[+get_tag]]`]]
        with get_tag varying depending on an url parameter. So if I cache the instruction I always get the same page.
        I’m just trying to do a land page for tagLister snippet.

          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Ah, like that.

          Indeed you’d need it uncached then.

          I’m afraid I don’t see a problem with the snippet, perhaps somebody else does....
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 29861
            • 59 Posts
            Thanks Mark.

            Maybe there’s another way to do my tagLister landing page?
            Anyone?
              • 29861
              • 59 Posts
              Well I didn`t solve the problem but checking the page as uncacheable, I don’t need to uncache my snippet and the placeholder and it works:
              [[getResources? &parents=`6` &includeTVs=`1` &tpl=`news` &tvFilters=`news_category==[[+get_tag]]`]]
                • 22303 MODX Staff
                • 10,725 Posts
                How/where/when are you setting the get_tag placeholder? This should work on cacheable Resources:
                [[!getResources? &parents=`6` &tpl=`news` &tvFilters=`news_category==[[!+get_tag]]`]]

                You need to make sure [[+get_tag]] isn’t coming from the cache as well.
                  • 29861
                  • 59 Posts
                  I set the placeholder via a snippet in the title field.
                  But the problem shouldn’t come from the placeholder itself since when I write a possible value like "Project" instead, it still make the problem and return an empty content.
                  The line OG proposed still provokes the same error (I had already tried it).

                  But I set uncacheable for the page and now it work...


                    • 22303 MODX Staff
                    • 10,725 Posts
                    It’s about order of processing. The snippet that sets the placeholder must run before that placeholder is encountered.
                      • 29861
                      • 59 Posts
                      Since the following line didn`t work too (like I said in the 1st post), the problem didn`t come from the placeholder:
                      [[!getResources? &parents=`6` &tpl=`news` &tvFilters=`news_category==Project`]]