We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45613
    • 45 Posts
    I am looking to build a large SAAS site using MODX, I hope.

    I have been reading all the information and tutorials about setting up contexts for multiple domains and setting up permissions to limit user access to see just 1 context.

    Some accounts (users) will just have 1 contexts, but another account could have a main context and 5 or 6 sub-contexts and 5 or 6 users? The assumption is that none of the "accounts" are related, but sub-contexts would be related and could share elements (templates, chunks, etc), but not pages (resources).

    My first question is will modx scale to support something like this?

    I assume that I will have to create sub-directories for each context. I am not wild about duplicating index.php, .htaccess, etc for each context, but if I can keep assets (css,js,images) separate, plus uploaded files, this would make cleanup when an account is closed, much easier. Thoughts?

    The one thing I have not done a lot of research on is - How to duplicate a portion of a website, 10-15 resources and related elements, and Duplicate (with one button) or export and import into a new context. I would use this to create a default environment when a new account is created. Is this possible? are there some addons that could do parts of this?

    Has anyone done anything like this? Am I asking to much of MODX?
    Please let me know any good reading material about any of these topics.

    Thanks in advance for the help!
    Bill

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Yes, MODx Revolution will certainly scale to something like this - that's what it was expressly designed for.

      http://rtfm.modx.com/revolution/2.x/administering-your-site/contexts

      You don't have to create unique home pages, each context has its own Context Settings that override the System Settings, so you could specify the resource ID to be your home page for each Context, or leave it to default to the System Setting.

      I think simply right-clicking on a context and duplicating it should also duplicate all resources in that context, or it may give you the option of doing so, I'm not really sure.

        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        While poking around looking for more information, I found this page, which has some very interesting suggestions for using Context Settings http://www.cmstricks.com/blog/2012/11/10/modx-context-settings/
          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
          • 45613
          • 45 Posts
          Thanks Susan for the help.

          based on my reading there are 2 primary ways to do multi-site with 1 code base.
          Either use a gateway plugin
          http://rtfm.modx.com/revolution/2.x/administering-your-site/contexts/using-one-gateway-plugin-to-manage-multiple-domains
          or using folders for each domain
          http://rtfm.modx.com/revolution/2.x/administering-your-site/contexts/creating-a-subdomain-from-a-folder-using-virtual-hosts
          There is a variation using pseudo-folders.

          I think I am leaning toward the folder approach, assuming that I can put all the assets (css, js, images, etc) for the domain in this folder too. (unless someone has a better idea)
          Can I point the context or User's File manager to this same folder? Any manual on that?

          Thanks for the context settings info - I think this will be a big help. I plan to do some texting with contexts soon, so I will test the duplicate.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Yes, the default global assets path and URL is set in the config.inc.php file, but this setting can be overridden in context settings, so each context can have its own site_start and modx_assets_path and modx_assets_url. You need both, since some supporting files need to be accessed internally by file path, while others are accessed by the browser via URL.

            If you do need a gateway plugin, my preferred plugins is this one which does not need any modification to the .htaccess or other rewrite methods. This is where it is used (see the comments, scroll down a ways to gadamiak's comment) in the case of multiple languages using contexts, very similar to your usaage.
              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
              • 45613
              • 45 Posts
              Great. I will start building out a test site to test out the things that we have talked about.
              I am sure I will have more questions.
              Thanks again.