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

    I’ve imported a site from EVO to REVO and i’m migrating Ditto to GetResources.

    Snippets works fine, but I need to sort by TV from this values: 10, 9.5, 9, 8.5, etc.

    Using DITTO: &orderBy=`numbers DESC` (this paremeters works fine)

    Using GetResources: &sortbyTV=`numbers` &sortdirTV =`DESC` (9.5, 9, 8.5, 10) Number 10 is in the end of the list.

    What should I do? (Sorry for my english)
    Cheers
      • 44234
      • 219 Posts
      Hi,

      Think I may have found a bug in getResources. The problem involves &showUnpublished, &showHidden and &showDeleted.

      I am using the following call:

      [[!getResources? &parents=`[[*slider-id]]` &resources=`[[*slider-resource]]` &showUnpublished=`0` &limit=`10` &sortby=`menuindex` &sortdir=`ASC` &hideContainers=`1` &includeTVs=`1` &processTVs=`1` &tpl=`slideshow-getr-temp`]]

      When just &parents is used, unpublished, hidden and deleted resources are removed from the output, which is correct. However, when &resources is used and &parents is blank, unpublished, hidden and deleted resources are still in the output. They are are only removed when the deleted resources are purged from the manager.

      Has anyone else experienced this or know of a solution?

      If it is a bug where should it be logged?

      Thanks
        Find me on Twitter, GitHub or Google+
        • 16942
        • 33 Posts
        It would be REALLY good if we could see this bug fixed next...
        https://github.com/opengeek/getResources/issues#issue/23

        We’re using getResources to do some cool stuff with a carousel on our homepage. We stored a comma-separated list of featured page IDs in a TV and then have getResources parse them and pull out the thumbnails. And of course the order of items in a carousel is quite important...
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: leoandrews at Mar 18, 2011, 07:26 PM

          It would be REALLY good if we could see this bug fixed next...
          https://github.com/opengeek/getResources/issues#issue/23

          We’re using getResources to do some cool stuff with a carousel on our homepage. We stored a comma-separated list of featured page IDs in a TV and then have getResources parse them and pull out the thumbnails. And of course the order of items in a carousel is quite important...
          First, this is not a bug, it’s a feature request. Second, I tried integrating the pull request and cannot get it to merge and function properly at all. I have asked the submitter to resubmit.

          Also, please feel free to make your own Snippets that are simple alterations of getResources for your specific purposes. This is not Ditto, and it’s not going to be a "this Snippet does everything" solution like Ditto was. I feel it is better to have a bunch of smaller Snippets to do specialized things efficiently than one monolithic solution to do everything much slower.
            • 671
            • 4 Posts
            I want to display the latest 2 news articles on my hope page, the problem is article 1 and article 2 uses different templates. I can display the latest article by:

            [[!getResources? &parents=`10` &limit=`1` &tpl=`article1` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

            is there a way to exclude latest article and display the second latest. I know that i can use "&resources=`-[id]`" but don’t know how to find latest articles id, it should be something like this:

            [[!getResources? &parents=`10` &limit=`1` &tpl=`article2` &resources=`-[id of the latest article]` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

            Thanks for any help.
              • 36541
              • 222 Posts
              Quote from: OpenGeek at Mar 19, 2011, 10:41 AM

              I have asked the submitter to resubmit.

              Updated already.
                This is the web: the only thing you know about who will come is that you don't know who will come.
                • 36541
                • 222 Posts
                I have an issue with template chunk’s output, which I guess comes from caching. I want to use 3 chunks to provide templates for `tpl`, `tplFirst` and `tplLast`.

                tpl = res.list
                ...
                
                tplFirst = res.list-first
                Some content before the list...
                [[$res.list]]
                
                tplLast = res.list-last
                [[$res.list]]
                Some content after the list...


                The idea is to use a single chunk for list items (`tpl`) and add custom content before and after the list. For easier maintenance a single `tpl` is used and called from other template chunks.

                The problem is that both `tplFirst` and `tplLast` templates return output for the same resource. That means the first resource is repeated as the first and last item on the list. If used with getPage this happens on every page. I played with uncached calls to `$res.list` but either got no output or no change.

                How to solve it?
                  This is the web: the only thing you know about who will come is that you don't know who will come.
                  • 36541
                  • 222 Posts
                  I have also another issue, similar to the previous one, when I want to output a descriptive content type for a resource being listed. In the `tpl` chunk I call the Rowboat snippet like this:

                  [[!Rowboat@content-type?where=`{"id:=":"[[+content_type]]"}]]


                  Which I expect to fetch a proper value in the `name` column from `modx_content_type` table and output it to a placeholder `[[+content-type]], which I then put somewhere in the `tpl` chunk.

                  It works, however the same value from first list item is applied to all resources being listed. Again, I played with uncaching chunk calls but to no avail.

                  Again, how to solve it?
                    This is the web: the only thing you know about who will come is that you don't know who will come.
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: ahmeter at Mar 22, 2011, 04:35 AM

                    I want to display the latest 2 news articles on my hope page, the problem is article 1 and article 2 uses different templates. I can display the latest article by:

                    [[!getResources? &parents=`10` &limit=`1` &tpl=`article1` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

                    is there a way to exclude latest article and display the second latest. I know that i can use "&resources=`-[id]`" but don’t know how to find latest articles id, it should be something like this:

                    [[!getResources? &parents=`10` &limit=`1` &tpl=`article2` &resources=`-[id of the latest article]` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

                    Thanks for any help.
                    Add &offset=`1` to the second call—you do not need the &resources property.
                      • 671
                      • 4 Posts
                      Quote from: OpenGeek at Mar 22, 2011, 09:48 AM

                      Quote from: ahmeter at Mar 22, 2011, 04:35 AM

                      I want to display the latest 2 news articles on my hope page, the problem is article 1 and article 2 uses different templates. I can display the latest article by:

                      [[!getResources? &parents=`10` &limit=`1` &tpl=`article1` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

                      is there a way to exclude latest article and display the second latest. I know that i can use "&resources=`-[id]`" but don’t know how to find latest articles id, it should be something like this:

                      [[!getResources? &parents=`10` &limit=`1` &tpl=`article2` &resources=`-[id of the latest article]` &includeContent=`1` &includeTVs=`1` &processTVs=`1`]]

                      Thanks for any help.
                      Add &offset=`1` to the second call—you do not need the &resources property.

                      Thank you! I actually solved the problem by using tplFirst and tplLast, as I only display 2 items. But it’s nice to learn the offset property, I am sure that I will need this with the coming projects.