⚠️ Urgent! Active Attacks on MODX Revolution Sites Below Revolution 2.6.5
Subscribe: RSS
  • Hi there,

    i try to accomplish following scenario:

    for a photography website i need a gallery-overview page which pulls each newest/first document from its subcontainers/folders without having several Ditto-calls:

    GalleryOverview (ID10)
    Portraits
    - Portrait 01
    - Portrait 02
    - ...
    Landscape
    - Landscape 01
    - Landscape 02
    - ...
    Black & White
    - Black & White 01
    - Black & White 02
    - ...

    does anyone know how to do this?

    and would it be possible to setup ditto, to automatically include a new category (pulling its newest/first document) & without having the client to add the ID of the new category-folder to the Ditto-call (maybe something like &parents=`10` &depth=`3` &hideFolders=`1`?)

    thanks, j
    • This cannot be done with a single Ditto call, but through the appropriate manipulation of the recursion it is possible to solve this task with a single clause that will meet all your requirements.

      I assume that the mentioned documents ("GalleryOverview", "Portraits", "Portrait 01", ...) are all containers. Photos are located under "Portrait 01", "Landscape 01", "Black & White 01", etc. Right? If so, then the task might be solved with something of this kind:

      [[Ditto? &parents=`10` &depth=`2` &display=`all` &filter=`isfolder,1,1` &tpl=`newest-photo`]]
      


      The above will catch all containers under "GalleryOverview" for two levels in depth. Now the most important part, content of the "newest-photo" chunk:

      [[Ditto? &parents=`[+id+]` &depth=`1` &display=`1` &filter=`isfolder,0,1` &tpl=`PhotoDoc` &sortBy=`createdon` &sortDir=`DESC`]]
      


      This chunk pulls newest (latest) photo doc for the each container caught on the first level of Ditto’s call. I have tested this idea and it is working.
      • Nice alik wink
        Bookmarked for future reference.
        • Hi alik,

          smiley thank you very much - i’ll test it and report back!!
          • works perfectly! thanks again, alik smiley