Being somewhat of a Disciple of Hal (DoH! <g>), I've dealt with this problem in
the following way:
In appGlobals (app_Globals, myGlobals, yourConventionHereGlobals), I use this
code:
<cfset circuitDir =
ListLast(GetDirectoryFromPath(GetCurrentTemplatePath()),"\")>
<cfif not isdefined("request.myPath")>
<cfset request.myPath="/">
<cfelse>
<cfset request.myPath="#request.myPath##circuitDir#/">
</cfif>
The cascading nature of includes down through the layers of fuseboxes results
in request.myPath becoming whatever the current circuit's path is, regardless
of where it's located (assuming, of course, that the Fusebox main app starts at
the site's root; otherwise stick a cfset in the top level globals file to set
the starting directory for the main app). Ergo, the image directory is always
"#request.myPath#images". One pitfall: if you use aliases in your web server
structure, you'll have to hardcode the alias instead of using
GetDirectoryFromPath...
Interesting sidenote on the use of ListLast:
ListLast("/foo/","/") resolves to "foo", but
ListLast("/foo/ ","/") resolves to " ". Caveat codor! <g>
Have fun,
- Jeff
On 13 Dec 00, at 23:59, Nat Papovich wrote:
> But again, when I'm making the "search" circuit, I don't know that I'm the
> search circuit. I think that I'm the "IT". There is no other. I don't have
> to say "request.search.images". I can just say "request.images" cuz I'm the
> top of it all.
>
> Even without being an arrogant little prick of a circuit, there are problems
> if another circuit called "search" gets wrapped up in the higher circuit
> that called the original search circuit. Now you have 2
> request.search.images vars, each one stepping on toes.
>
> Which brings me back to my original guiding principal that everything must
> be relative to itself.
>
> De only thing I can reckon is to require that every circuit have a unique
> name. If that's possible, then you can map a dir on the webserver and use
> the request.search.images variable. But there's still a problem if there is
> someone higher than you, calling your nice collection of circuits, and that
> app has an existing "search" directory. So someone DOES have to be in charge
> of the whole hoohaw after all. But the point of all this is that any circuit
> call be cfincluded without any ramifications! Doh!
>
> Anyway, somebody should step in about now and set the rickety-record
> straight.
>
> FAT NAT
>
>
> > -----Original Message-----
> > From: Steve Nelson [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 13, 2000 11:45 PM
> > To: Fusebox
> > Subject: Re: the dot notation
> >
> >
> > Seems like each circuit could have it's own imagesroot couldn't it?
> >
> > If you're using dot notation to distinguish the circuit, why not just
> > add a .images to it.... like this:
> >
> > <cfset request.search.images="http://images.funkynat.com/search">
> > <cfset request.products.images="http://images.funkynat.com/products">
> >
> > hmmmmmmmmmmmmmmmmm.....
> >
> > That only works if your images are off the CF server, which
> > is good, but
> > not practical when getting started. Makes things harder.
> >
> > Steve Nelson
> > http://www.SecretAgents.com
> > Tools for Fusebox Developers
> >
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists