We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40404
    • 21 Posts
    I thought this would be a simple constant or context setting but I can't find it. How do I reference the active context path within a snippet?

    E.g.,
    /var/www/html/web/ might be the default context, MODX_BASE_PATH
    /var/www/html/alt/ is a second context... how do I reference this, without redundantly manually defining a context setting with this value?
      • 3749
      • 24,544 Posts
      The context object itself doesn't have a path. I don't think there's any way to do it without creating a Context Setting. Once you do that, you can access it like this, since Context Settings will override System Settings:

      $path = $modx->getOption('setting_name');
        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