We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50971
    • 7 Posts
    Hi! I'm working on Revo 2.3.5.
    I have a collection of grouped objects in resource tree, e.g. parent resource "building" which have childs like "bilding_foo", "building_bar", etc. Each child must have image gallery, legal doc list and other types of files. Without MODx (in pure php) I usually created some folder structure like 'uploads/bildings/building_foo/gallery', 'uploads/bildings/building_foo/docs', etc...and that structure used for each new building created. Could you advise me how can I realize that approach in MODx or may be there is more elegant way for storing and grouping static resources in MODx?

    P.S. Creating and editing of resources will be invoked mostly by front-end users through API calls. But also content manager must have controls for editing resource's inner images (through TV as I suppose).

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

    [ed. note: mikkabond last edited this post 11 years, 1 month ago.]
    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can use the MIGX migxResourceMediaPath snippet as the path and URL for a Media Source. That will use (and create if necessary) a folder for each resource it's used with, for example for TVs.

      https://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-media-source-and-multifile-uploader#MIGX.Useresource-specificmediasourceandmultifile-uploader-Createthedynamicresourcespecificmediasource

      Using media sources for static resources is problematic, since static resources were developed before media sources, and were never modified to use them as static elements do. You can use a media source for selecting a file to use the static resource for, but there are some limitations.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 50971
        • 7 Posts
        Thanks, I will trying to adopt this for my task.