Template Not Working With New Context

I’m using Modx Revo 3.03. I created a new context for a new site and then created a template for the new site. When I go to view the home page of the new context I get the template from the base home page, even though the correct template is selected. What step am I missing?

So is it the correct content that you see with the wrong template, or does it just load the the wrong page?

It could be, that your router plugin just doesn’t switch to the correct context. Then you see the “error_page” of the default context (which by default is the resource with ID = 1).

No, the template of Context 2 is definitely the template of Context 1. I didn’t know if I had to assign a template to a particular context or if it just worked. I’m not accessing Context 2 yet via a domain, but rather just mydomain . com? id=xx" if that makes a difference.

I don’t think that you can view a resource that is not in the default context without using a router plugin.
My guess is that you just see the error page of the default context.

A template is not context-specific. The templates are shared between the contexts.

Thank you. I’ll set up a subdomain which routes to the new context and try it that way.

I don’t think it has to be another subdomain or domain, but at least you will need a plugin, which switches the context.
XRouting can switch by subfolder, too

XRouting (jako.github.io)

You could also write a simple routing plugin for testing purposes.
Something like this should work:

if($modx->context->get('key') != 'mgr') {
    $id = (int) $_GET['id'] ?? 0; // read value of 'id' parameter
    if ($id) {
        $r = $modx->getObject('modResource', $id); // query resource
        if ($r) {
            $r_ctx = $r->get('context_key');
            if ($r_ctx != 'web') {
                $modx->switchContext($r_ctx); // switch to resource context

Choose OnHandleRequest as the event for the plugin.

Thank you so much. I’ll give it a try!