We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11155
    • 74 Posts
    Hi,

    On my local installation, I set up a second site in modx Revolution (the first site being the modx demo), using contexts for that matter. I set it up according to this post (in french sorry, but it should be understandable). To this point, everything is fine.
    The problem is, my images are under "D:\Wamp\www\modx\sites\site2\img" and I want to select some to use in a TV; when I’m using the file browser to select a file, the resulting path looks like "sites/site2/img/myimg.png" which get output by modx as "<img src="sites/site2/img/myimg.png"/>" where I need to have "<img src="img/myimg.png"/> instead.
    How can I achieve this ?
      • 3749
      • 24,544 Posts
      Do you have this in the <head> section of your template:

      <base href="[[++site_url]]" />


      You can create a context setting that specifies the site_url for that context.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 11155
        • 74 Posts
        Quote from: BobRay at Oct 08, 2010, 11:54 PM

        Do you have this in the <head> section of your template:

        <base href="[[++site_url]]" />


        No, it was commented out to test my template outside modx, I forgot to uncomment it... but it does not change anything !

        You can create a context setting that specifies the site_url for that context.

        I already have a site_url setting pointing to http://localhost/modx/sites/site2 undecided
          • 3749
          • 24,544 Posts
          It looks like it’s an issue with the file browser. I don’t know how it calculates the path or if there are any settings that will fix your problem. Hopefully, someone else does.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 11155
            • 74 Posts
            Yes that’s what I think, there should be a setting to indicate the file browser the base path for urls.

            Edit: I tried adding rb_base_path and rb_base_url settings to my context, pointing to /sites/mysite2/ but still no improvement.
              • 11155
              • 74 Posts
              I also played with rb_base_dir, filemanager_path and filemanager_url, the only improvement I had is with filemanager_path set to sites/mysite2 -> now the filemanager starts browsing from the correct path (so I only select "img/myimage.png", but it is still returns the full path "sites/mysite2/img/myimage.png".

              Any advice ? Or should I create a new modx installation for each site - which defeats the purpose of having one modx installation to manage several sites ? undecided
                • 3749
                • 24,544 Posts
                You can always edit the paths manually until a solution shows up. wink
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 11155
                  • 74 Posts
                  If I manually edit the paths, can I be sure that a future solution won’t break what I did and force me to edit all the paths again ? shocked
                    • 3749
                    • 24,544 Posts
                    Upgrade installs shouldn’t mess with those settings.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 11155
                      • 74 Posts
                      I’m wondering if the problem could be related to the fact that I’m using external files as templates: my template files are in /sites/site2, the hierarchy is this:

                      modx
                      |- (modx default folders)
                      |- sites
                      |- site2
                      |- mytpl.html
                      |- css
                      |- mycssfiles.css
                      |- img
                      |- myimgfiles.png

                      so my template files have relative paths to img and css files, ex:
                      <link rel="stylesheet" type="text/css" href="css/mycss.css" />

                      but modx puts link related to the modx root folder. If my template was in the DB, I would use full relative paths like this for it to work:
                      <link rel="stylesheet" type="text/css" href="sites/site2/css/mycss.css" />

                      and so the links from the file manager would have the same relative root and I think would have no problem with the paths anymore ?