<![CDATA[ How to Force Custom Child Templates - My Forums]]> https://forums.modx.com/thread/?thread=104823 <![CDATA[How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563666
I've tried both forceTemplate and inheritTemplate but neither seem to do anything.

Mind you the instructions are a bit light and obtuse.

Thanks]]>
markg Jan 20, 2019, 01:21 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563666
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563694
but i finally figured out how to use Inherit Template
https://modx.com/extras/package/inherittemplate

by my usual method of stumble about and try things.

You know how it is when you first read some instructions: They make absolutely no sense and then after a few days of frigging about you find out how to do it, and then the instructions finally make sense, after the fact.

It's the tech gods messing with us.

PS the extra is a very elegant solution.

]]>
markg Jan 21, 2019, 05:43 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563694
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563689
/* Only  operate on new resources */
if (!($mode == modSystemEvent::MODE_NEW)) {
    return;
} 

/* Set all new resources not at the root 
   of the tree to use template 12 
*/

$parent = $resource->get('parent');
if (! empty($parent)) {
    $resource->set('tempate', '12');
    $resource->save();

}

return '';


This will set the template for *all* new resources on the site with parents to use template 12. If that's not what you want, you can add some conditions to the code so it only operates when you want it to.]]>
BobRay Jan 21, 2019, 04:25 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563689
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563674 lkfranklin Jan 20, 2019, 06:50 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563674 <![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563673
Although as I said, I haven't been able to figure out how to use them.

]]>
markg Jan 20, 2019, 05:38 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563673
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563672
]]>
BobRay Jan 20, 2019, 05:24 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563672
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563671
I want to set a different template to the parent.

And yes I know I can manually select a different one, but i want to know if I can set a parent's children to automatically use a different template.]]>
markg Jan 20, 2019, 03:49 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563671
<![CDATA[Re: How to Force Custom Child Templates]]> https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563670 BobRay Jan 20, 2019, 03:36 AM https://forums.modx.com/thread/104823/how-to-force-custom-child-templates#dis-post-563670