We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24987
    • 12 Posts
    Richard Davies Reply #1, 20 years ago
    Is there a way to make quickedit use absolute URLs instead of relative ones? For example, I’m referring to the URLs uses inside the <head> tag to include the javascript libraries like prototype and scriptaculous:

    <!-- Start QuickEdit headers --><br /><script type="text/javascript"><br /> var modId = ’1’;<br /> var managerPath = ’/manager/’;<br /> var modPath = ’assets/modules/quick_edit’;<br /></script><br /><script src="assets/modules/quick_edit/javascript/cookies.js" type="text/javascript"></script><br /><br /><script src="assets/modules/quick_edit/javascript/output.js" type="text/javascript"></script><br /><script type="text/javascript" src="manager/media/script/scriptaculous/prototype.js"></script><br /><script type="text/javascript" src="manager/media/script/scriptaculous/scriptaculous.js"></script><br /><link type="text/css" rel="stylesheet" href="assets/modules/quick_edit/styles/output.css" /><br /><!-- End QuickEdit headers --></head>


    I need it to use "/assets/..." instead of "assets/..." etc.
      • 22303 MODX Staff
      • 10,725 Posts
      The relative URLs really are necessary to keep your site definition portable. Instead of defining all your paths as absolute in your content, including js script includes, I recommend using the base href tag in your templates (in the HEAD element, before the appearance of any elements with src or href attributes) to properly keep all paths referring to the correct location. In reality, since modx is executing from a single url (/index.php), the path is always relative to that location, regardless of where it sits in relation to your web servers document root.
        • 24987
        • 12 Posts
        Richard Davies Reply #3, 20 years ago
        The relative URLs really are necessary to keep your site definition portable.
        What exactly do you mean? I’m not sure I see the advantage of relative URLs for things like js script includes.

        P.S. Thanks for the help. I’d forgotten about the <base href=""> tag!


          • 22303 MODX Staff
          • 10,725 Posts
          Consider moving a site to or from a subdirectory; with absolute paths the entire site would break in a subdirectory, as it would be looking for the modx dependencies in the document root, not the actual root location of MODx which is the location that PHP would be using as the location of the currently running script.

          Though this may not be important to everyone, it’s something I’ve run into countless times, for instance, when testing a new release sometimes I like to try it out as a subdirectory of the real site, or a subdomain, and if all my paths were hardcoded, it would be a real pain in the rear.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Indeed, and if for some reason your host becomes unsatisfactory and you want to move your site it makes things a lot easier.
              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
              • 24987
              • 12 Posts
              Richard Davies Reply #6, 20 years ago
              Thanks for the tips, but honestly, I don’t think moving the MODx installation up/down a few subdirectories is very likely. Even if you were to change hosts, you wouldn’t need to change the directory structure it was in.