We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21884
    • 57 Posts
    i’ve been using contexts as a way to separate resources for my client for a site i’m building on revolution.

    i’ve been searching around, but since i’m not using a subdomain for the separate contexts, the guide on that hasn’t helped me.

    basically i list a set of resources in one context that my client has access to, and he’ll edit/add/remove resources from there to his heart’s content.

    i have the main site in the "web" context and for the most part i’m getting resources from the other context using snippets and it works fine, with one exception, when i generate a link to a document in that context, the link is generated as if the document and it’s parent were in the "web" context, but clicking on the link sends me to the "document not found" page rather than listing the resource.

    am i doing something wrong? i’ve added anonymous with load permission and a level of 9999 to this context, copying what i saw for the web context, but that hasn’t helped. what am i missing here? or is it not possible to link cross-context like i am doing?

    example, my site is like this:

    web/
    web/search
    web/search/search-results.html

    on that page i get a list of items from

    documents (this is my 2nd context)
    documents/category1/
    documents/category1/document1.html
    documents/category2/
    documents/category2/document2.html

    etc...


    so the link that gets generated by modx from

    web/search/search-results.html

    is:

    web/category2/document2.html


    does that link not work since category2 is in a different context?
      • 22303 MODX Staff
      • 10,725 Posts
      How are you building the links?
        • 21884
        • 57 Posts
        like this:

        [[~[[+id]]]]
          • 22303 MODX Staff
          • 10,725 Posts
          Do you have a base_url set differently in the document context from the web context? It’s not totally clear what you are describing here, but web/ would never be a valid URL in the documents context if I understand correctly. The URL structure in the document context should follow the parent Resources in that context, plain and simple if you are not changing any settings per context.
            • 21884
            • 57 Posts
            /web/ and /document/ aren’t in the URL, i just used them to show where the resources are that i’m trying to access/access from

            i want to link from a resource in /web/ to a resource in /document/

            when i create a link in a resource in /web/ to a resource in /document/, it creates links the same as if the resource was in /web/, relative to the root of my site.

            i’m not using contexts to divide up sites across domains/subdomains

            i was using it to sort my content, but i guess the contexts aren’t made for that.
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: Lance at Jun 22, 2010, 08:17 PM

              i’m not using contexts to divide up sites across domains/subdomains

              i was using it to sort my content, but i guess the contexts aren’t made for that.
              If you use it to divide content, there has to be a way to identify which context it is in. This might be the first segment of the URL, or the domain/sub-domain name, or a decision based on data from the client browser accessing the site. If you can identify some way for MODx to know when to "switch contexts", then contexts are made for this purpose.
                • 21884
                • 57 Posts
                if i were to have a sub-folder called "documents" in this case, and then link to documents in there, how would i go about directing modx to use this folder?