We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 436 ☆ A M B ☆
    • 265 Posts
    Has anyone figured out how to make one template inherit a different template?

    A but like how the Evo plugin Inherit Selected Template would work: http://modxcms.com/extras/package/?package=214

    I’ve tried this but it doesn’t seem to be working:

      MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
      • 28215
      • 4,149 Posts
      What version of Revo are you using? This was fixed in 2.0.3.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 436 ☆ A M B ☆
        • 265 Posts
        Yeah that was it! rolleyes
          MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
          • 436 ☆ A M B ☆
          • 265 Posts
          So lets say I have a template for all the parent folders, then different templates for the sub-pages, like so:


          • Parent Template
            [list]
            [li]Section One Template
          • Section One Template

          [/li]
          [li]Parent Template

          • Section Two Template
          • Section Two Template

          [/li]
          [li]Parent Template

          • Section Three Template
          • Section Three Template

          [/li]
          [/list]

          I can do this using the Field Default Value to target the template, but is it possible to set a contraint on the Resource ID for each of the parents? I was expecting either of these Constraints to work but they don’t...





          Any ideas?
            MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
            • 436 ☆ A M B ☆
            • 265 Posts
            Also, is it possible to use modDocument in the Constraint Class field? I noticed this under the Page Settings tab titled Class Key - is that what this is for?

            Could I in theory set my own Class Key, e.g. pageServices, and then call this as a constraint?
              MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
              • 28215
              • 4,149 Posts
              The 1st should work, but there’s a bug in 2.0.3 with regard to the default template in FC rules when using constraints. It has been fixed here: http://github.com/modxcms/revolution/commit/2c67c2b8dcf56ad4cbeeef1bca3f7e4cbb61fee1
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 436 ☆ A M B ☆
                • 265 Posts
                That fix worked smiley

                The next thing I realised is Form Customisation rules set with "resource/update" obviously won’t be applied when a new Resource is now created inside these parent folders... so I needed to duplicate all my rules and changed the Action to "resource/create", however this didn’t seem to work

                This is the rule for "resource/update", which works fine:



                This rule for "resource/create" doesn’t work:



                Is this due to the new template being applied after these rules are read, which means they are ignored? (maybe I need to set the order the rules are fired in?)


                I noticed this following rule, which is being applied to all Resources regardless of the template restraint is still being applied to the new Resource:



                Any ideas where I’m going wrong this time? undecided
                  MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                  • 28215
                  • 4,149 Posts
                  Can you file these specific issues on our bugtracker, so we can work this out for 2.0.4? http://bugs.modx.com/
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 436 ☆ A M B ☆
                    • 265 Posts
                    Damn, so these are bugs then? sad

                    Seems your bug tracker is down right now (getting a 504 Gateway Time-out) - any ideas on this, would that perhaps work?
                      MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                      • 28215
                      • 4,149 Posts
                      Yes, you should apply that fix.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com