We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5430
    • 247 Posts
    Can any of you smarter-than-me people help me get my brain around how to accomplish this? The example below is quite specific, but I've often wondered about this topic and can't find a viable solution in any discussion I've seen yet.

    My current example:
    I'm building a website for a publication that produces weekly issues. In the manager, each issue will consist of a parent document with each story in the issue as a child resource. The issues are numbered consecutively and the issue number is used as the parent document's pagetitle (i.e. 9131526). Each child includes a tv that records it's page number in the print version. I'm building my asset directory structure to match the resource tree (i.e. 'assets/public/issues/9131526/' would be the asset directory for the issue, and 'assets/public/issues/9131526/13-head.jpg' would be the header image for the child resource with the page tv value set to 13.) Images will be uploaded as a separate activity and will be done prior to the editors logging into the manager to edit/update an issue.

    What I want to do is set my image tvs to a default value that's built based on the parent's pagetitle and the current resource's tv.page value so that my client will see preselected images - if they exist - but can upload/override them with custom images if needed on a story-by-story basis (sometimes the image used in print won't be licensed for web use, or viable because of proportions).

    My understanding is that I can't access the current resource object within media sources, so I can't grab this info via a snippet call in my media source basepath. I also can't seem to get a snippet to run within my image TV default value using @EVAL, so I'm not sure if this is even possible or if I'm overreaching.

    Any genius ideas or obvious solutions I'm missing?

    Running MODX 2.2.9 in MODX Cloud
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      My understanding is that I can't access the current resource object within media sources, so I can't grab this info via a snippet call in my media source basepath. I also can't seem to get a snippet to run within my image TV default value using @EVAL, so I'm not sure if this is even possible or if I'm overreaching.
      As far as I understand, you can use the current resource object in a Media Source - see http://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader
        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
        • 5430
        • 247 Posts
        I'll read up on that. Hadn't thought of using MIGx, and would prefer not to, but may find my answer there anyway. Thanks for the tip, I'll post here with what I figure out.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The first add-ons I install on any new Revo installation are Wayfinder and MIGx. I have trouble imagining developing any site without MIGx. I'd say it's Revo's "killer app".
            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