Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending application.cfc in a subdirectory
    text
    copied!<p>I have the following two files and would like the second to extend the first:</p> <ol> <li>wwwroot\site\application.cfc</li> <li>wwwroot\site\dir\application.cfc</li> </ol> <p>However, when I go to declare the component for the second file, I'm not sure what to put in the extends attribute. <strong>My problem is that several dev sites (with a shared SVN repository) are running off the same instance of ColdFusion</strong>, so I can't just create a mapping in the CF admin like so:</p> <pre><code>&lt;cfcomponent extends="site.application"&gt; </code></pre> <p>However, ColdFusion doesn't like:</p> <pre><code>&lt;cfcomponent extends="..application"&gt; </code></pre> <p>or any dynamic input like:</p> <pre><code>&lt;cfcomponent extends="#expandpath('..').#application"&gt; </code></pre> <p>Creating a runtime mapping (<a href="https://stackoverflow.com/questions/287187/extend-a-cfc-using-a-relative-path">like here</a>) doesn't seem possible either. Creating it in the base application.cfc is useless because that code hasn't yet executed by the time the inheriting cfc is being declared; and I can't create the mapping before the inheriting component is defined because there isn't yet an application to attach it to.</p> <p>Is there any way I can reference the parent directory to accomplish my extends?</p> <p>Edit to clarify: The ApplicationProxy solution doesn't work because of the bolded text above. Right now, as a workaround, we're simply not checking the \dir\application.cfc into SVN so that each developer can keep a version that extends his/her own root application.cfc. Obviously, this is not ideal.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload