We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9191
    • 20 Posts
    I try to insert a link in TinyMCE to the URL /assets/files/whatever.pdf and TinyMCE trims it to just assets/files/whatever.pdf instead. Of course that doesn’t work because I’m using friendly paths so the URL ends up looking like http://www.mysite.com/folder/assets/files/whatever.pdf which does not exist.

    How can I keep TinyMCE from removing leading slashes?
      • 4018
      • 1,131 Posts
      I’ll need to experiment and test with friendly URL’s but...err...I don’t think this has anything to do with that. Try setting the Path Options in the TinyMCE config (http://wiki.modxcms.com/index.php/TinyMCE). I’m thinking that rootrelative or fullpathurl outta work. smiley

      Jeff
        Jeff Whitfield

        "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
        • 9191
        • 20 Posts
        OK, I changed it to rootrelative and now it’s inserting links from the linklist as /manager/[~40~] rather than just /[~40~] as I expected. huh
          • 4018
          • 1,131 Posts
          Whoa...this is for the links inserted in via the LinksList? Hmm...guess I need to check that out! If so, good call! smiley

          Jeff
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
          • The problem is this: all links in a MODx site should be relative from the site root, as that should always be your base in a MODx page. Folders are virtual. But you also need to be able to work with them in the manager interface, which is not in the site root.

            If you maintain your <base href="[(site_url)]"></base> tags in your templates to make sure the image shows up, then when in the manager this doesn’t apply. So really, editors working with the content and inserting relative URLs need a) the path to be correct so the image actually shows up on the page, and b) the path to be approximated in the manager so the editors can also see the images are there from their RTE view. I don’t believe this has ever been solved properly...
              • 9191
              • 20 Posts
              Quote from: Bravado at Jun 29, 2007, 02:31 AM

              Whoa...this is for the links inserted in via the LinksList? Hmm...guess I need to check that out! If so, good call! smiley

              Jeff

              Maybe I didn’t state the problem well enough.

              I have a site that’s using friendly url paths. When I’m editing the page /doctors/aboutus.html and I try to insert a link- no matter what the method- no leading foreslash is inserted. This is a problem if I’m trying to insert a link to a different section of the path, ie /patients/form.html. If I insert one myself, it is removed. The only way for me to get the foreslash in is to turn off TinyMCE and change it manually.

              I have tried:

              • typing the whole link (/patients/form.html
              • Using just the modx code ([~40~])
              • Typing the modx code WITH a leading slash (/[~40~])
              • Using the Link List

              Every single time, no leading foreslash is present after I save. The links, being now relative to the friendly path /doctors/, now all point to /doctors/patients/forms.html which is not a page that exists.

              The trimming the foreslash thing is a TinyMCE issue, I’m sure of it; but this raises another issue- if the modx code [~40~] is going to output the whole path anyway, it should also output a foreslash at the beginning. that would effectively solve this problem. It would also prevent any difficulty with images not showing up from /manager/ because the images would automatically be relative to the site root.
              • evan, if you’re using friendly URL paths you MUST have the code in your header section that jason suggested in order for it to work. I think you’ll be pleasantly surprised by the results:

                <base href="[(site_url)]" />
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 9191
                  • 20 Posts
                  alright, after doing that (and changing Path Options back to docrelative) it appears to work correctly.

                  I still don’t like TinyMCE second-guessing me, can I turn that off?
                    • 4018
                    • 1,131 Posts
                    I’ll document and explore this later. Might be able to put in some checks that ensure that paths are put in correctly. smiley

                    Jeff
                      Jeff Whitfield

                      "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                      • 14786
                      • 57 Posts
                      Quote from: evan at Jun 29, 2007, 03:34 PM

                      alright, after doing that (and changing Path Options back to docrelative) it appears to work correctly.

                      I still don’t like TinyMCE second-guessing me, can I turn that off?

                      I just had the same problem and used the <base href="[(site_url)]" /> solution. I’m with evan on this one and don’t think Tiny should be touching my links. Especially without an easily accessible option to turn that feature off. They’re my links, I’ll put them the way I want them damnit. smiley