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

    I'm experiencing a very strange issue.

    I have a modx revo 2.2.10 clean installation, and I'm developing a multilingual website using one context per language

    I added some custom context settings to "web" context:

    base_url -> /it/
    site_url -> /it/
    ...

    At some point I realized that $modx->getOption('base_url') returns '/' (wrong) if I'm logged into the manager, and returns '/it/' (right) if I'm not logged in.

    Any ideas?

    Thanks in advance
    Alessandro

    This question has been answered by multiple community members. See the first response.

      • 17959 ☆ A M B ☆
      • 57 Posts
      Magnatron [Maarten Wolzak] Reply #2, 12 years, 8 months ago
      I always advise clients to either use 2 different browsers (one for CMS management, other for front-view) or two tabs and do the CMS at the http://example.com/manager and the front-viewing at http://www.example.com

      When you are logged into the manager your session is a mix of the 'web' context and the 'mgr' context.

      Out of curiosity: How are your absolute URL's ending up? I always thought that the site_url setting was used for the basic "http://www.example.com/" part. Are absolute URL's ending up as '/it//it/' or not?
      • discuss.answer
        • 3749
        • 24,544 Posts
        When you're logged into the Manager, and not previewing the front end, that getOption() call will get the base_url System Setting (if there is one) unless there is a base_url Context Setting for the 'mgr' context. If there's no base_url System Setting and no 'mgr' Context Setting, it will use the url the user came in on. All of these will be overridden by a base_url User Setting, though that's rarely used.

        The process uses the settings in this order, stopping with the first success:

        base_url User Setting
        base_url Context Setting for current context
        base_url System Setting
        url the user came in on

        The same process is followed for site_url. All other settings, AFAIK, use just the first three steps.
          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
        • discuss.answer
          • 37625
          • 38 Posts
          Hi BobRay,

          thanks a lot! Now things are clearer.