Ticket #54 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

FUSEBOX_CALLER_PATH for chained includes

Reported by: scorfield Owned by: scorfield
Type: enhancement Priority: low
Milestone: Fusebox 5.1 Component: Miscellaneous
Version: 5.0 Severity: normal
Keywords: Cc:

Description

From Harry Klein:

My colleague suggested to add a fusebox parameter called
FUSEBOX_CALLER_PATH:

========================================================

Fusebox 5 sets "this.approotdirectory" wrong if the calling template
which includes the fusebox5.cfm (mostly index.cfm) is included by
another template which is in a different directory than the calling
template (index.cfm). This is because "this.webrootdirectory" is
calculated on the base template, which is in a different directory in
this case.

With the optional fusebox parameter FUSEBOX_CALLER_PATH we could force
the "this.approotdirectory".
Per default FUSEBOX_CALLER_PATH would be the same as the detection of
"this.webrootdirectory"
(#replace(getDirectoryFromPath(getBaseTemplatePath()),"\","/","all")#)
and Fusebox 5 would perform like before.

fusebox5.cfm
added line 58: <!--- FB5: caller path --->
added line 59: <cfparam name="FUSEBOX_CALLER_PATH" type="string"
default="#replace(getDirectoryFromPath(getBaseTemplatePath()),"\","/","a
ll")#" />
changed line 81:
    from:
.init(FUSEBOX_APPLICATION_KEY,FUSEBOX_APPLICATION_PATH,myFusebox) />
    to:
.init(FUSEBOX_APPLICATION_KEY,FUSEBOX_APPLICATION_PATH,myFusebox,FUSEBOX
_CALLER_PATH) />

fuseboxApplication.cfc
added line 88: <cfargument name="callerPath" type="string"
required="true" 
added line 89:     hint="I am FUSEBOX_CALLER_PATH." />
changed line 102:
    from:    <cfset this.approotdirectory = this.webrootdirectory &
replace(arguments.appPath,"\","/","all") />
    to:       <cfset this.approotdirectory =
replace(arguments.callerPath,"\","/","all") &
replace(arguments.appPath,"\","/","all") />

optional in index.cfm:
<!--- Force Fusebox 5 to set the appRootDirectory based on the location
of this template --->
<cfset FUSEBOX_CALLER_PATH =
getDirectoryFromPath(getCurrentTemplatePath())>

========================================================

What do you think about this idea?

Attachments

Change History

Changed 2 years ago by scorfield

  • status changed from closed to reopened
  • resolution deleted

Changed 2 years ago by scorfield

  • priority changed from normal to low
  • type changed from defect to enhancement

I don't have much of an opinion on this yet.

Changed 2 years ago by scorfield

  • owner changed from sean@corfield.org to scorfield
  • status changed from reopened to new

Funnily enough, I ran into this exact same issue with a Mach II application recently (the HTML test runner for cfcUnit). So now I "get" the issue and see why it's useful.

Changed 2 years ago by scorfield

  • status changed from new to closed
  • resolution set to fixed

(In [293]) Fixes #54 by adding the optional FUSEBOX_CALLER_PATH variable.

Note: See TracTickets for help on using tickets.