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


    I use a call like this one :

    [[pdoResources?
    &tplCondition=`parent`
    &conditionalTpls=`{"36":"templateA","41":"templateB","51":"templateC","8":"templateD","9":"templateD","10":"templateD","11":"templateD","12":"templateD"}`
      &parents=`4,36,41,51`
      &limit=`0`
      &hideContainers=`1`
      &includeTVs=`tvVideoUrl,tvAuteur,tvCitation,tvItemSize`
      &tvPrefix=``
    ]]



    Now my client tells me he only wants the three or four last items from parent #4, in combination with all the rest. It's late out there, I have to hurry and I'm about to conclude that I can't handle this with a simple getResources call. Can someone tell me what might be done ?

    All the items must be displayed following their publication date ; they should be all mixed up together...

    This question has been answered by kehezen. See the first response.

      Sorry for that ⇧ , I'm no dev but I wanna try
      • 3749
      • 24,544 Posts
      With getResources (and maybe pdoResources) You can use negative numbers to exclude specific resources, so you could block out specific ones you don't want. I don't think there's any other way to do it without using a custom snippet.

      &resources=`-12,-23,-24`
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 15558
        • 108 Posts
        That won't work for me, resources of each kind will be added continuously, but I need the keep to three newest items (only) from one category (only). The excluded-items list would grow with no end...


        I am looking at &groupby et &having properties in pdoResources, but I can't figure out how to use them... Does someone get it ?

        &groupby Indicate the field by which results are grouped

        &having It is used to limit the sample of grouping lines by condition for the whole group, specified in &groupby

        as on http://docs.modx.pro/en/components/pdotools/general-settings
          Sorry for that ⇧ , I'm no dev but I wanna try
          • 4172
          • 5,888 Posts
          That won't work for me,

          That would, but you will need a snippet, which gets all resources of parent #4, but not the latest and return a commasepareted list with negative ids.

          &resources=`[[getMyResourcelistWithNegativeIdsButNotTheLatest? &latestLimit=`4` &parent=`4`]]`

            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
          • discuss.answer
            • 15558
            • 108 Posts
            Thank you Bruno, I've read your post and thought at first "Thanks but that's far from my skills".

            Then I've played with the few Lego pieces I can handle and got something working - no doubt it's far from optimal, but it works. Thank you again.


            To my pdoRessources call I added :
              &resources=`[[$oldItemsExcluder]]`


            &oldItemsExcluder
            [[pdoResources?
            	&tpl=`tpl-oldItemsExcluder`
            	&outputSeparator=`,`
            	&parents=`8,9,10,11,12,13,14,15`
            	&limit=`99999`
            	&offset=`4`
            	&sortby=`publishedon`
            	&sortdir=`DESC`
            ]]
            


            (&offset with &limit=`0` doesn't work.)

            &tpl-oldItemsExcluder
            -[[+id]]



            Thanks Bob also !
              Sorry for that ⇧ , I'm no dev but I wanna try