We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40944
    • 78 Posts
    By default in MODx you get the base element with the base link for your website. Since that was causing some problems, I wanted to get rid of it. But doing that caused my Wayfinder menu (and possibly some other links) to fail, because the path was concatenated to the current url (friendly urls and containers enabled).

    So I took a look at the option for link scheme (I believe the setting is called link_tag_scheme) but there wasn't an option to prepend a / to everything so it would link from the root or your domain. But there was an option abs (absolute) which used a value from a different setting.

    As that setting wasn't available yet, I created a new record and gave it the value '/'. So now I have set my link scheme (global setting AND wayfinder parameter) to 'abs' so my links are correct and I could get rid of the base tag.

    Have any of you encountered this problem before? How did you solve it? Is this a correct approach, or am I forgetting something (that could cause problems)? [ed. note: might-e last edited this post 12 years, 11 months ago.]
      • 40944
      • 78 Posts
      Okay, the first problem has surfaced.

      Links made using TinyMCE and the MODx browser (or whatever it is called) don't work as the are doc relative. I have tried setting the pluginsettings to rootrelative, but this doesn't seem to affect anything. Does anyone know how to solve this problem?
        • 18608
        • 112 Posts
        I'm not completely sure on what exactly you are trying to accomplish?
          Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          There is [[++site_url]], which is your full site's URL. There is [[++base_url]], which is usually just "/", or if your site is installed as a subdomain something like "/subdomain/".

          By default, the link_tag_scheme is "rel" (relative), which will create relative URLs like "mypage.html". Using "abs" (absolute) will create absolute URLs like "/mypage.html" or "/subdomain/mypage.html". Using "full" will create a full URL, "domain.com/mypage.html".
            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
            • 27708 MODX Staff
            • 2,502 Posts
            Since that was causing some problems, I wanted to get rid of it.

            What problems was the base element causing. It makes the most sense to solve that, rather than removing it. At this time, MODX FURLs rely on it, as do contexts.

            If you could elaborate on what issues you're having and what you'd like to solve we may be able to find you a workable solution.
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 40944
              • 78 Posts
              Quote from: sottwell at Nov 06, 2013, 06:08 AM
              There is [[++site_url]], which is your full site's URL. There is [[++base_url]], which is usually just "/", or if your site is installed as a subdomain something like "/subdomain/".

              By default, the link_tag_scheme is "rel" (relative), which will create relative URLs like "mypage.html". Using "abs" (absolute) will create absolute URLs like "/mypage.html" or "/subdomain/mypage.html". Using "full" will create a full URL, "domain.com/mypage.html".
              I never thought of using '/' as the base url. As far as I know the default is http://domain.com. Just using '/' would probably be a more sensible solution.



              Quote from: smashingred at Nov 06, 2013, 06:09 AM
              Since that was causing some problems, I wanted to get rid of it.

              What problems was the base element causing. It makes the most sense to solve that, rather than removing it. At this time, MODX FURLs rely on it, as do contexts.

              If you could elaborate on what issues you're having and what you'd like to solve we may be able to find you a workable solution.
              On my guestbook pages it would kill links from users that only type 'www.domain.com'. The visitors on my website are mostly people that don't have a clue on how the web works at all so that confuses them. Also I believe that because with the base tag set to the full url it would cause browsers to read the full URL and would make them do DNS lookups all the time, which shouldn't be necessary because it's on the same domain, right?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                One problem I have had with using a base tag is that JQuery UI developers have decided that using it is evil, and will not fix their tabs code to work with one. JQuery UI tabs will load the entire page into a tab. This was fixed for previous versions, but they've decided not to do so for version since 1.9. There are a number of javascript patch to solve the problem. For example,
                http://stackoverflow.com/questions/13837304/jquery-ui-non-ajax-tab-loading-whole-website-into-itself
                  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
                  • 28120
                  • 380 Posts
                  This worked for me, inserting the page url into the tab url

                  <li><a href="[[~[[*id]]]]#tabs-1">Tab 1</a></li>
                  <li><a href="[[~[[*id]]]]#tabs-2">Tab 2</a></li>
                  <li><a href="[[~[[*id]]]]#tabs-3">Tab 3</a></li>
                  


                  I also have

                  <base href="[[++site_url]]" />
                  
                    • 40944
                    • 78 Posts
                    But wouldn't it make way more sense to always generate links relative to the site root, prefixed with a '/'? MODx knows the current path and everything, so why are links made in a way that you need to use the base tag?

                    I just tried putting a '/' in the base tag and that seems to work nicely.
                      • 17959 ☆ A M B ☆
                      • 57 Posts
                      Magnatron [Maarten Wolzak] Reply #10, 12 years, 11 months ago
                      Quote from: might-e at Nov 06, 2013, 06:18 AM
                      Quote from: sottwell at Nov 06, 2013, 06:08 AM
                      There is [[++site_url]], which is your full site's URL. There is [[++base_url]], which is usually just "/", or if your site is installed as a subdomain something like "/subdomain/".
                      On my guestbook pages it would kill links from users that only type 'www.domain.com'. The visitors on my website are mostly people that don't have a clue on how the web works at all so that confuses them. Also I believe that because with the base tag set to the full url it would cause browsers to read the full URL and would make them do DNS lookups all the time, which shouldn't be necessary because it's on the same domain, right?
                      About the guestbook entries: the easy solution is Output Modifiers. Use
                      <a href="http://[[+guestbook_url:replace=`http://==`]]">[[+guestbook_url:replace=`http://==`]]</a>


                      About the DNS lookup. It doesn't matter if its '/' or 'http://your-domain.com/'. Most browsers don't do any DNS lookups. The computer they're installed on do the lookups. And those computers normally use a DNS cache of some sort. If you experience extra load times, check your website with some webmaster tools like the one at GTMetrix or Google's page speed tool they give valuable tips on how to improve.