Hi Lads,
Just thought I’d share something I just did and don’t think would be a bad idea going forward. I simply modified the Inherit Parent Template plugin to be more Inherit Sibling or Parent Template plugin.
I think most people would prefer that a document starts off with the same template as a sibling than a parent. Anyway, just thought I’d put it out there.
Cheers
Troot
/*
* Written By Raymond Irving - 12 Oct 2006
*
* Simply results in new documents inherriting the template
* of their parent folder upon creating a new document
*
* Configuration:
* check the OnDocFormPrerender event
*
* Version 1.0
*
*/
global $content;
$e = &$modx->Event;
switch($e->name) {
case 'OnDocFormPrerender':
if(($_REQUEST['pid'] > 0) && ($id == 0)) {
$siblings = $modx->getChildIds($_REQUEST['pid']);
if(sizeof($siblings) > 0){
foreach($siblings as $sib){
if($sib != $id){
$sibinfo = $modx->getPageInfo($sib, 0, 'template');
$content['template'] = $sibinfo['template'];
return;
}
}
}
if($parent = $modx->getPageInfo($_REQUEST['pid'],0,'template')) {
$content['template'] = $parent['template'];
}
}
break;
default:
return;
break;
}