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]> 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
> > > > The new Australian search engine for businesses, products and services
>
> > > --
> > > *** { . } { . } ****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
-~----------~----~----~----~------~----~------~--~---

Reply via email to