I'm somewhat new to ColdFusion and I'm trying to understand the best way to use cfinclude'd files. The thing that I find limiting is that files are included in-line as if they were part of the including template. That's nice and simple but that means that any relative paths inside the included file are resolved relative to the includer, not the included file. This becomes a problem in the following file layout:
a.cfm <--- cfincludes b.cfm
b.cfm <--- cfincludes c.cfm
c.cfm
somedir/d.cfm <--- cfincludes ../b.cfm
When a.cfm includes b.cfm, all works well. When d.cfm includes ../b.cfm, the include within b.cfm of c.cfm will fail since it is resolved relative to d.cfm. So, two questions for my edification:
Is there a best practice for CF along the lines of "files that you expect to be included from other files shouldn't include relative links"?
I'm trying to understand the design decision. I understand the notion that the effect of a cfinclude is as if the included file were part of the includer - there's an elegant simplicity to that. But are there non-pathological cases where one prefers to have relative links resolved this way? I can think of cases where I want them resolved "traditionally", i.e. relative to the file they are located in. Maybe I'm missing something.