myfusebox variable scope
I recently saw some searches on "fusebox myfusebox scope", and thought this might be a nice little topic to cover as its a variable scope which I personally use quite a bit. These are as follows:
- myFusebox.originalCircuit: the original circuit as part of this page's requested fully-specified fuseaction. It's the "circuit" part of "circuit-dot-fuseaction" and is a simple string variable.
- myFusebox.originalFuseaction: the original fuseaction as part of this page's requested fully-specified fuseaction. It's the "fuseaction" part of "circuit-dot-fuseaction" and is a simple string variable.
- myFusebox.thisCircuit: as a Fusebox request executes it may make calls internally to fuseactions in other circuits as part of its job. This is a simple string variable which is continuously updated during a page request to reflect which circuit the Fusebox is currently operating in.
- myFusebox.thisFuseaction: as a Fusebox request executes it may make calls internally to fuseactions in other circuits as part of its job. This is a simple string variable which is continuously updated during a page request to reflect which fuseaction the Fusebox is currently executing.
- myFusebox.thisPhase: as a Fusebox request executes it passes through a series of defined phases. This simple string variable tracks which phase the Fusebox is in at any given moment in the page request.
- myFusebox.thisPlugin: since developers have the opportunity to extend core file functionality via plugins, and these plugins fire during set phases in the page request, this simple string variable tracks which plugin, if any, is currently being executed.
Quick Example Usage
A simple example of using this is within a form post. Here we have a simple form posting to the Original Circuit's fuseaction named 'two'.
<input type="Submit" name="Submit" value="Next">
</form>
This piece of code or cfm page can be dropped into any circuit folder and always reference the 'original circuit' as its posting circuit. I know what you may be thinking, isnt this why I use XFA's? Well, in short the answer is yes.
Fusebox Debug
The myfusebox scope also contains debugging information accessible by setting myFusebox.showDebug = true.
Hide the fusebox debugging output using CSS is also a possibility, as noted by Sean Corfield. You can do it in Fusebox with the myFusebox.showDebug = false setting, and the CSS code would be:
Some added benefits include the download size of the debugging output, cut in half, and it should stay a little more consistent across different site designs all while being customizable.
External Links
-
Fusebox 5 Component myFusebox CFC Doc: provides the per-request myFusebox data structure and some convenience methods.