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

    I’ve been using Modx for a while now and just made the switch to Revolution 2.0.2. One problem I’ve just come up against is that when I make an Image Template variable, the url output is always relative, which obviously isn’t very handy as friendly url paths get built up.

    For example, my page at url ’www.test.com/topic1/section1’ may have an image on it that is in a folder in the root of the site (say in the folder project/images). When I select this in the resource browser of my tv, it gets the path correct, but as it is relative it can’t find the image as it omits the first forward slash (/) to look in the root of the site.

    I thought changing the ’file manager path’ in system settigns would fix this, and have set it to be /projects/, but it keeps stripping out the leading /, and so outputs projects/images/image.gif, when I want /projects/images/image.gif.

    Any help on this would be much appreciated - been banging my head against a wall for a while now!

    Cheers
      • 28215
      • 4,149 Posts
      You should always add this to the HEAD of your document if you’re using FURLs:

      <base href="[[!++site_url]]" /> 
      
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 7975
        • 2 Posts
        Yep, that’s done the trick smiley

        Thanks!
          • 15308
          • 25 Posts
          Quote from: splittingred at Sep 27, 2010, 07:52 AM

          You should always add this to the HEAD of your document if you’re using FURLs:

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


          Hi
          I have the same problem for a multilingual site. site_url is different for each language context (ie for the english part of the site, site_url is http://mywebsite/en/ ; for the french part, site_url is http://mywebsite/fr/ . Both contexts share images in /assets/images .
          So with <base href="[[!++site_url]]" /> , the url of an image in a document of the english context would be http://mywebsite/en/assets/images/image.jpg which is not the expected url. Do you have an idea how I can solve that?
          Regards
            • 28215
            • 4,149 Posts
            If you want global assets (CSS/JS for all contexts), add a system setting [[++my_assets_path]] and prefix your imgs/css to it:

            <img src="[[++my_assets_path]]images/img.png" alt="" />

              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 15308
              • 25 Posts
              Thanks Shaun for your quick reply. It will work for chunks, snippets and plugins.
              But how to make it work with TinyMCE? (I agree with you, this is not the same question ;-))
                • 8023
                • 4 Posts
                Any new insights on this issue?
                I struggle with the same issue in a multilingual environment.

                As this slowly becomes almost a standard feature of MODx with the ’Bable’ plugin, it might be a good idea to have an ’asset_path’ setting as part of the core setup.