We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23571
    • 223 Posts
      [list]Have been looking at this post: http://modxcms.com/forums/index.php/topic,59915.0.html

      I am following the steps below, but when I create a new resource under ID9 am still inheriting the parent template.
      [list]
    • Form Customizations->Created a new profile
    • Edit Profile
    • Create New Set
      [list][li]Action->Create Resource
    • Template->The TemplateID I want inherited
    • Constraint Field->parent
    • Constraint->Resource ID of the parent
    • Active->checked
    [/li][/list]
    [/list][/list]
    Is this still the appropriate method for having children inherit a different template than the parent?
      • 3749
      • 24,544 Posts
      That looks right to me. You might have to clear the cache and flush permissions and sessions before it will take effect.
        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
        • 23571
        • 223 Posts
        Hmmm, I have flushed the server cache, flushed permissions, flushed all sessions, and cleared my browser cache and am still getting the same results. When I attempt to create a child document under ID9 I am still inheriting the template of the ID9 document rather than the one specified in my Active Form Customization/Profile/Set. Any other suggestions? This is 2.1.1-pl btw.

          • 3749
          • 24,544 Posts
          Do you have any plugins running that might affect the template on save?
            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
            • 23571
            • 223 Posts
            Am running plugins - listening to:

            • modMobile - OnLoadWebDocument, OnLoadWebPageCache
            • ColorPicker - OnDocFormPrerender, OnTVInputRenderList
            • SimpleSearchIndexer - OnDocFormSave, OnDocPublished, OnDocUnpublished, OnResourceDelete, OnResourceDuplicate, OnResourceUndelete
            • TinyMCE - OnRichTextBrowserInit, OnRichTextEditorInit,OnRichTextEditorRegister
              • 24068
              • 4 Posts
              Quote from: pleth at Jun 16, 2011, 09:22 AM

              Am running plugins - listening to:

              • modMobile - OnLoadWebDocument, OnLoadWebPageCache
              • ColorPicker - OnDocFormPrerender, OnTVInputRenderList
              • SimpleSearchIndexer - OnDocFormSave, OnDocPublished, OnDocUnpublished, OnResourceDelete, OnResourceDuplicate, OnResourceUndelete
              • TinyMCE - OnRichTextBrowserInit, OnRichTextEditorInit,OnRichTextEditorRegister

              Try to disable all and see if it works. If yes, reenable one plugin by another to find the one that caused problems.

              If no then no plugin causes that problem.

              (and remember to clear modxs cache before and after every each step, you never know...)
                • 33976 ☆ A M B ☆
                • 571 Posts
                Just a note… i see you’ve defined a template (County Template). But Upon resource creation, your resource might not use this template (according to what you set as default template in your system settings). That might be a part of the issue…
                  • 23571
                  • 223 Posts
                  Okay, that sounds reasonable but how then do you have a child document inherit a template other than the parent?
                    • 33976 ☆ A M B ☆
                    • 571 Posts
                    You have to search in the grid for the template field (modx-resource-settings) & set its default value to the template ID you’d like to use.
                      • 3749
                      • 24,544 Posts
                      I think I’d do it with a plugin tied to OnDocFormSave. Something like this:

                      <?php
                      
                      $parentId = 6;
                      $desiredTemplate = 3;
                      
                      /* only act on new resources */
                      if ($mode == modSystemEvent::MODE_NEW) {
                      
                          /* make sure we have one */.
                          if ($resource) {
                              if ($resource->get('parent') == $parentId) {
                                  $resource->set('template', $desiredTemplate);
                                  $resource->save();
                              }
                          }
                      }
                        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