We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51020
    • 670 Posts
    Hi all.
    I'm trying to get organised, by creating a dev subdomain as a context within my Modx installation.
    I have it all working - but I have one issue. The paths to all the images css etc are looking in the root level of my subdomain (which I would expect), but if I try and add images to resources (within TinyMce or TVs) the path it creates is from the Web context.
    Do I need to create a sepearate Media Source for the Dev context?

    and if so, how does that affect my workflow - The reason I have set this all up is so that the client can approve pages on the dev site - and then I could just change the parent from the Dev context to the Web context when approved - but then I would have to go and fix all my paths again - Any ideas?

    Maybe contexts isn't the way forward?

      • 17301
      • 932 Posts
      What's the issue with having the paths coming from the web context if the intention is to move resources to their anyway?

      Another alternative solution would be to create a 'dev only' area that only X usergroup can access and assign your clients user to this group. Or use pagelocker to page protect an individual or group of resources.

        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 51020
        • 670 Posts
        Quote from: lkfranklin at Feb 27, 2017, 09:55 AM
        What's the issue with having the paths coming from the web context if the intention is to move resources to their anyway?

        Another alternative solution would be to create a 'dev only' area that only X usergroup can access and assign your clients user to this group. Or use pagelocker to page protect an individual or group of resources.


        That's a good point - and Ideally I would get it to work this way - but then how do I get the image paths in the dev site to look in the web context instead of the dev context?

        For example, the images all reside at www.domain.com/assets/ but the image path being produced on the dev context is: dev.domain.com/assets/ but the images aren't there.

        I can fix this by changing the base_url on the dev site to www.domain.com/ but then the navigation all gets broken, as the URLs all include the web context domain instead of the dev context subdomain.

        (As you can tell, this is my first dip into contexts!!)

        Thanks
        Andy
          • 17301
          • 932 Posts
          I *think* you need to go into media sources and edit the file system resource and set the base path and base url there, as well as the relative to no.
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 51020
            • 670 Posts
            Quote from: lkfranklin at Feb 27, 2017, 10:16 AM
            does it not work with
            <base href="[[!++site_url]]">


            ?

            I just responded ,but it seems to have disappeared! I'll try and explain again below:

            it does work, but it means having a copy of all the assets within dev.domain.com/assets/ as well as www.domain.com/assets/

            This bring s me back to my original problem - that when I add an image the media sources are selecting the images from the files in www.domain.com/assets/ but the URL to the image display as dev.domain.com/assets - so it's possible that the image I select is either not present, or is a different version if I have two copies.

            I hope this makes sense!

            Andy
              • 51020
              • 670 Posts
              Quote from: lkfranklin at Feb 27, 2017, 10:22 AM
              I *think* you need to go into media sources and edit the file system resource and set the base path and base url there.

              OK - so does that mean an additional media source for each context?
                • 17301
                • 932 Posts
                Sorry I kept second guessing myself - someone else may be able to give you a more definitive answer but yes I believe you can do it with your current media source but if you edit the paths and relativity there that might steer you in a better direction.
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                  • 51020
                  • 670 Posts
                  Quote from: lkfranklin at Feb 27, 2017, 10:25 AM
                  Sorry I kept second guessing myself - someone else may be able to give you a more definitive answer but yes I believe you can do it with your current media source but if you edit the paths and relativity there that might steer you in a better direction.

                  Hmm Ok thanks - the base_path and base_url are both set to:
                  assets/files/

                  So presumably the resources within each context should look relatively to the base_url.
                  The problem is that if I don't keep the assets folders synchronised, then I can't simply rely on moving the resources to the live context as the images could differ.

                  I think I need to go back to the drawing board!

                  Thanks for your advice though!

                  Andy



                    • 17301
                    • 932 Posts
                    Try setting the paths to
                    www.domain.com/assets/files/

                    and turn the relativity off on both base path and base url.
                      ■ email: [email protected] | ■ website: https://alienbuild.uk

                      The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                      • 51020
                      • 670 Posts
                      Quote from: lkfranklin at Feb 27, 2017, 10:29 AM
                      Try setting the paths to
                      www.domain.com/assets/files/

                      and turn the relativity off on both base path and base url.

                      Hmm - sounds like a great solution - but when I try this, the media source is now empty when I try and browse the images (form either context!)