For the record, I think this is a useful proposal and I've created
a patch which implements it.
Say the web browser requests foo.adp. If foo.adp's master tag has a src attribute, that file is used as the master template. If foo.adp's master tag has no src attribute, then the current directory is searched for a master.adp file. If one is found, it is used as the master template. If not, then we go one directory up and look again. We keep going up until we find master.adp. If we get to the serverroot without finding one, then we use the master specified in the DefaultMaster parameter.
Now, if the master template that we find also has a master tag in it, then we include whatever we have now (foo.adp + local master.adp) inside DefaultMaster. Note, that we don't look up to the next directory in this case. Confusing, I know.
Here's an example.
/www/content/computer/foo.adp
foo.adp
has a <
master
> tag with no src attribute, so it searches for
/www/content/computer/master.adp
. Lets say it's not there. It then goes up 1 directory and finds
/www/content/master.adp
. It dutifully includes all of
foo.adp
inside the <
slave
> tag that is in
/www/content/master.adp
. But we're not done yet because
/www/content/master.adp
happens to have its own <
master
> tag. So, we include everything we have and stick in the DefaultMaster's <
slave
>. Another (better) approach would be to take everything we have and look for the next most local
master.adp
(i.e.
/www/master.adp
). I couldn't figure out an easy clean way to do that. Within the scope of the <
master
> tag, you only have access to the file being requested, not the file being parsed. So it's hard to know which level of the
master
hierarchy we are at. Perhaps there's a way to do it inside
template::adp_parse
, but I'd have to do some more research or get help from the templating gods.
The current patch fits my needs, but I could see value in having even more flexibility.