If you haven't heard, MODX CMS has long supported a feature called “Contexts” that allows a MODX site owner to manage multiple domains, subdomains, locations, apps, or anything else, within one MODX Manager interface.
It's an incredibly powerful feature, and one that truly sets MODX apart as a fully-capable CMS compared with some other open source options.
Sometimes it's useful to access configuration settings from a Context other than the one in which the currently loaded Resource resides.
This is made easy and performant via the MODX API, by using the getContext() method. You simply pass it the name of the context you want, and you get the context object - from cache if it's available.
At that point you'll likely want to access the Context settings. Here's a simple gist that illustrates how to do that:
Note the option to output all context settings to placeholders. Hello MODX and super powerful flexibility! :D