We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I’m not having any luck at changing the default template at the context level. I’ve created a key ’default_template’ and set the value to ’2’ (the ID of the template I want to be my default). But when I create a new resource in that context, it still defaults to the overall default template that I’ve set under system settings. I’ve tried "refresh context" and that makes no difference. What am I missing?

    Related question: where can I find info on the various keys that a context finds meaningful? I followed instructions at http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php to set up multiple contexts, and was exposed to keys like http_host, site_url, base_url, site_name, site_start, error_page, and default_template... but surely these are a subset of a larger list. Where can I find more info?
      • 28215
      • 4,149 Posts
      Quote from: jrotering at Feb 18, 2010, 03:16 PM

      I’m not having any luck at changing the default template at the context level. I’ve created a key ’default_template’ and set the value to ’2’ (the ID of the template I want to be my default). But when I create a new resource in that context, it still defaults to the overall default template that I’ve set under system settings. I’ve tried "refresh context" and that makes no difference. What am I missing?

      That might actually be a bug - making context-specific default_template might not work yet. I’ll look into it.


      Related question: where can I find info on the various keys that a context finds meaningful? I followed instructions at http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php to set up multiple contexts, and was exposed to keys like http_host, site_url, base_url, site_name, site_start, error_page, and default_template... but surely these are a subset of a larger list. Where can I find more info?

      There is a list of all the default Settings here: http://svn.modxcms.com/docs/display/revolution/System+Settings

      Any of those can be overridden per context.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 39982
        • 28 Posts
        Hello!

        I have this issue now. I did once this to another site and it works perfectly, but now I don't understand where is the problem.

        I have two context (web) and (archives).

        Context (web) includes resources with different templates and everything here is ok.
        Context (archives) includes one resource with template (32)

        Context (archives) settings are
        Base Url --- base_url --- /
        Default Template --- default_template --- 32
        HTTP Host --- http_host --- www.sitename.com/archives
        Archives --- site_start --- 122
        Site URL --- site_url --- http://www.sitename.com/archives/

        Weird thing is when I move resource page from (archives) to (web) everything looks fine and resource use template which I choose.

        MODX Revolution 2.2.11-pl (traditional)

        Thank You!
        Tom
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          New resources created in the archives context should use the specified template in the 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
            • 39982
            • 28 Posts
            Hi!

            I did duplicate the main template that is used in (web) resources.

            I have different template for both contexts (web) and (archives).
            When I'm in manager and create new resource in (archives) context, it use that duplicated template what I did for (archives) context, but when I click "view" resource it shows (web) template on that resource.

            Problem is that why (archives) context still use (web) context default template?

            Thank You,
            Tom
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I don't know. I don't clearly understand what you are saying. I suppose it's a language problem.

              1. You have a template that you are using for resources in the (web) context. When you create resources in the (web) context they use that template.

              2. You have duplicated that template to use in the (archives) context- #32. When you create a resource in the (archives) context they use that template, #32.

              3. The pages look the same on the front-end. Well, if template #32 is a duplicate of the template for the (web) context, of course they will look the same.

              So I must be missing something.
                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
                • 39982
                • 28 Posts
                Hi Sottwell and thank you!

                1. Yes, that's right.

                2. Yes.

                3. I did a duplicate of the (web) template which I use for the main pages. Then I modified and save the duplicated template for the (archives) context- #32.

                That is really weird when I drag resource page from the (archives) context to the (web) context everything looks fine and resource page behaves like it should when I click "view".

                Tom
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  And what happens if you actually view the site itself, rather than the "preview" option for the resource from the Manager?
                    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
                    • 39982
                    • 28 Posts
                    Hi!

                    When I write the address straight to the browser window like www.sitename.com/archives/ it's still shows the wrong template on that page. I don't know how it's even possible when I wrote www.sitename.com/whatever/ browser show a page and not an error message that page not found, because there is nothing on that www.sitename.com/whatever/ URL.

                    Maybe this is .htaccess issue?

                    Tom
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      By default the MODX "not-found" page is the home page (actually resource #1). That may be your whole problem. The first thing I always do after installing MODX is to create a dedicated "not-found" page and change the value of the System Setting error_page to use #2 instead of #1 as the error (not-found) page.

                      In your situation, if you want a different not-found page for your context, you'll need to set the error_page for your 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