Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • Add-ons
  • Creating & Repurposing Content
  • Ditto
  •  
  • [solved] how to pull each first/newest document from different containers #

  • 26931
    2,262
    fancypants menu: http://modxcms.com/forums/index.php/topic,31940.0.html

    sharkbait Reply #1, 2 years, 9 months ago

    Reply
    • Link to this post#1
    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


  • 1122
    209

    Alik Reply #2, 2 years, 9 months ago

    Reply
    • Link to this post#2
    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.


  • 4310
    2,276
    Snippets : eForm 1.4.4.7 with SMTP & PMS's security fixes | PHC Results | EasyNewsletter from CSV

    Wiki Articles : Custom DB table to placeholders | Manager Locked Out?

    Websites : Work - U.K. based MODx development  |  Hobby - Free interactive education resources for teaching 4 - 11 year olds

    Hosting : One Smart Host - Professional MODx hosting 

    bunk58 Reply #3, 2 years, 9 months ago

    Reply
    • Link to this post#3
    Nice alik Bookmarked for future reference.


  • 26931
    2,262
    fancypants menu: http://modxcms.com/forums/index.php/topic,31940.0.html

    sharkbait Reply #4, 2 years, 9 months ago

    Reply
    • Link to this post#4
    Hi alik,

    thank you very much - i'll test it and report back!!


  • 26931
    2,262
    fancypants menu: http://modxcms.com/forums/index.php/topic,31940.0.html

    sharkbait Reply #5, 2 years, 9 months ago

    Reply
    • Link to this post#5
    works perfectly! thanks again, alik





Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
Alik, bunk58, sharkbait

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy