The problem is simple. Every coldfusion template is already expanded, hence why getTemplatePath can be beneficial. The actual problem is that when you extend a component and it doesn't matter if it's one directory up or 10 up and 2 more in.
The extended component takes on the path of the component that uses it, this is Taco's problem there is a solution I just don't have it on the top of my head. Which means Taco has just identified the same problem I have been trying to get the Coldfusion Development team to acknowledge with the new per application mappings. Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 -----Original Message----- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of David Harris Sent: Wednesday, 6 June 2007 4:14 PM To: cfaussie Subject: [cfaussie] Re: Get root of the application I obviously don't understand what he's asking. Is the scenario if you have an Application.cfc that sets an Application variable to the web root on start up, and if you hit a template in a sub directory, the wrong value is in the path? ...cause that's what: <cfoutput>#expandPath("/")#</cfoutput> ...does...not matter where in the Application it is run...based on the testing I have done anyway On Jun 6, 5:59 pm, Andrew Scott <[EMAIL PROTECTED]> wrote: > Taco, > > I know what you are saying now, there is an answer but I have it in code I > have at home. > > Andrew Scott > Senior Coldfusion Developer > Aegeon Pty. Ltd.www.aegeon.com.au > Phone: +613 8676 4223 > Mobile: 0404 998 273 > > From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > Of Taco Fleur > Sent: Wednesday, 6 June 2007 3:52 PM > To: cfaussie@googlegroups.com > Subject: [cfaussie] Re: Get root of the application > > I give up.... > > On 6/6/07, David Harris <[EMAIL PROTECTED]> wrote: > > I just created a folder struct of [root]/one/two/bob.cfm > and put the code: > <cfoutput>#getDirectoryFromPath(expandPath("/"))#</cfoutput> > > in bob.cfm, and it gave me the correct web root... > > I also put a onRequestStart function in my Application.cfc: > > <cffunction name="onRequestStart" output="true"> > <p> > here: <cfoutput>#getDirectoryFromPath(expandPath("/"))#</cfoutput> > </p> > </cffunction> > > ran "/one/two/bob.cfm"...and the correct web root was output > > so from my testing > <cfoutput>#getDirectoryFromPath(expandPath("/"))#</cfoutput> > > works every time... > > On Jun 6, 5:30 pm, "Taco Fleur" <[EMAIL PROTECTED] > > > > <mailto:[EMAIL PROTECTED]> > wrote: > > If you put this in the main application.cfc file and then make sure the > app > > is not initialized, call a page within the sub directory (i.e. the one > where > > the application.cfc is that extends the main one) then you will get the > path > > of the sub directory and not the main root. > > > I've now created a .cfm file that is included onApplicationStart and sets > > the appropiate variable. > > > On 6/6/07, David Harris < [EMAIL PROTECTED]> wrote: > > > > how bout this?: > > > > <cfoutput>#getDirectoryFromPath(expandPath("/"))#</cfoutput> > > > > On Jun 6, 2:45 pm, "Taco Fleur" <[EMAIL PROTECTED]> wrote: > > > > Does that work for you if you put it in an application.cfc that > extends > > > the > > > > root application.cfc, and access a page in that sub directory first, > > > also > > > > make sure the app is not initialised yet. > > > > > Let me know.. > > > > > On 6/6/07, Andrew Scott <[EMAIL PROTECTED]> wrote: > > > > > > This not work for you, sure works for me? > > > > > > getDirectoryFromPath(getCurrentTemplatePath()) > > > > > > Andrew Scott > > > > > Senior Coldfusion Developer > > > > > Aegeon Pty. Ltd. > > > > >www.aegeon.com.au > > > > > Phone: +613 8676 4223 > > > > > Mobile: 0404 998 273 > > > > > > *From:* cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] > > > *On > > > > > Behalf Of *Taco Fleur > > > > > *Sent:* Wednesday, 6 June 2007 12:31 PM > > > > > *To:* cfaussie@googlegroups.com > > > > > *Subject:* [cfaussie] Get root of the application > > > > > > Hi all, > > > > > > I used be able to get the root of an application by putting > something > > > like > > > > > getCurrentTemplate() in the root application.cfm, even if I included > > > the > > > > > root application.cfm in sub application.cfm files it would record > the > > > > > right path, i.e. that of the root. > > > > > > Now with the application.cfc I cannot get the right path anymore, > > > because > > > > > if the application is initialised through an application.cfc in a > sub > > > > > directory, it reports the path of that sub directory. I've also > tried > > > all > > > > > other functions like getBaseTemplate etc. nothing gives me the right > > > output, > > > > > the path of the root application.cfc is what I am after. > > > > > > Only thing I can think of is putting a cfm file in the root that > > > outputs > > > > > the path I am after. I don't like hard coding it. > > > > > > Thanks. > > > > > > -- > > > > > <http://www.clickfind.com.au> http://www.clickfind.com.au > > > > > The new Australian search engine for businesses, products and > services > > > > > -- > > > > *** { . } { . } **** <http://www.clickfind.com.au> > > http://www.clickfind.com.au > > > > > The new Australian search engine for businesses, products and > services- > > > Hide quoted text - > > > > > - Show quoted text - > > > -- > > *** { . } { . } ****http://www.clickfind.com.au > > The new Australian search engine for businesses, products and services- > Hide quoted text - > > > - Show quoted text - > > http://www.clickfind.com.au > The new Australian search engine for businesses, products and services- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---