We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47635
    • 33 Posts
    Hello.
    There is multidomain site (a.site.ru, b.site.ru, c.site.ru etc). It is realized by contexts (context per subdomain).
    Each context has settings (e.g. site_url="a.site.ru/" and site_start=*some_id*).
    There is resource tree "Projects" in context "web". How we can make this resource tree common for other contexts (for use in getResources and Wayfinder)?
    Sorry for my English.

    This question has been answered by yasya_popkin. See the first response.

    [ed. note: yasya_popkin last edited this post 11 years, 4 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Specify the context in the snippet properties - &contexts=`web`. Make sure the 'web' context Context Settings are set for the site_url and base_url.
        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
        • 47635
        • 33 Posts
        Quote from: sottwell at May 19, 2015, 09:35 AM
        Specify the context in the snippet properties - &contexts=`web`. Make sure the 'web' context Context Settings are set for the site_url and base_url.
        getResources make links, related to web context, even if user located in other one.

        user at web context:
        site.ru
        site.ru/projects/
        site.ru/projects/foobar

        user at a context:
        a.site.ru
        a.site.ru/projects (symlink to web)
        site.ru/projects/first_project (PROBLEM IN URL)
        site.ru/projects/second_project (PROBLEM IN URL)

        There is symlink for "Projects" in rest contexts. But I dont want to copy a lot of symlinks for projects (over 9000) to >10 contexts. And all projects must be available in all variants of url (site.ru/projects/first_project, a.site.ru/projects/first_project, b.site.ru/projects/first_projec etc).

        Corner solution is writing sync plugin, which will make all symlinks automatically.
          • 3749
          • 24,544 Posts
          You can use a &where property in the getResources tag. It takes a JSON string specifying the criteria for the search. This would get you all published, non-deleted, resources in a particular context:

          {"published":"1","deleted":"0","context_key":"SomeContextName"}


          I think when you use &where, the &parents property will still be honored, but I'm not positive.
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            That was an example, you probably want to use &contexts=`[[*context_key]]` to get the current context.
              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
              • 4172
              • 5,888 Posts
              maybe, you would be better, to have all this projects in a custom table?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 47635
                • 33 Posts
                Maybe I explained it incorrectly.
                1) All pages are available.
                2) If user at a.site.ru and click on project link then he successfully redirected to project page, but URL of project page without subdomain.
                maybe, you would be better, to have all this projects in a custom table?
                No problem, I can. But I don't believe that there are no any solutions for MODX.
                  • 4172
                  • 5,888 Posts
                  did you try to get the absolute url?
                  For example in a getResources-tpl:

                  [[~[[+id]]? &scheme=`full`]]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                  • discuss.answer
                    • 47635
                    • 33 Posts
                    The problem has been solved by writing the plugin, which registered to event "OnPageNotFound".
                    For example, when user open sub.site.ru/projects, which does not exists, MODX outputs content of site.ru/projects. The same behaviour for childs.