Excellent, Andy.  Glad to hear it.  You are now officially a 
Fuseboxer. ;)

Before you get too enamored of pre- and post-fuseactions, let's 
clarify what a fuseaction is.  That will probably help you decide 
where you want to do specific things.  Then we'll look at things like 
global variables, etc.

A fuseaction is any collection of fuses you need to accomplish a 
task.  So, if you have a form that uses a droplist so the user can 
pick an employee, you need to hit the database for the data that will 
populate the droplist.  In this case, the fuseaction would have (at 
least) two fuses: a query fuse to create the recordset of employees, 
and a display fuse to render the form.  It would look like this in 
circuit.xml:

<fuseaction name="showBonusesForm">
  <include template="qryGetEmployees" />
  <xfa name="saveRaiseButton" value="hr.saveRaises" />
  <include template="dspBonusesForm" />
</fuseaction>

You can deduce from this code that the form has button that says 
"Save Raise", and when you click it the form will submit to 
xfa.saveRaiseButton, which contains the fuseaction "hr.saveRaises".

OK, we're good with what a fuseaction is.  Let's talk about 
application-wide variables. Yes, fusebox.init.cfm is a good place for 
them.  It is included at the point in the process after the Fusebox 
framework has been loaded, but before the process starts.  So, it's a 
good place to set up things like DSN, the "self" variable, etc.  For 
example, if you look at the fusebox.init.cfm from Wegot Widgets, 
you'll see these lines:

<cfset self="index.cfm" />
<cfset myself="#self#?#application.fusebox.fuseactionVariable#=" />

The variable "application.fusebox.fuseactionVariable" allows us to 
use a variable name other than "fuseaction" to store the fuseaction.  
This can be useful if we're working for a client who is unreasonably 
suspicious of Fusebox. ;)  Anyway,  
application.fusebox.fuseactionVariable doesn't exist until Fusebox 
loads the framework from fusebox.xml.  So you couldn't use those two 
lines in Application.cfm or index.cfm before calling the Fusebox 
core.

For your user-specific variables, I would suggest creating an action 
fuse to set them up, and including the action fuse in a fuseaction 
that is called following successful user validation.  You really only 
want to put code in the postfuseaction if you want it processed after 
*every* fuseaction in the circuit.  Those occasions are rare.

Anyway, keep at it and keep posting questions.

- Jeff

On 15 Feb 2005 at 17:36, Andy Mcshane wrote:

> Jeff, you have just helped me have my first fusebox lightbulb!!! Thank
> you so much, at least I should get some sleep tonight. Now before my
> train of thought completely runs away with me, based on the order of
> process below am i correct in thinking that all application wide
> variables, such as I used to initialise/setup in aplication.cfm,
> should now be done in fusebox.init.cfm i.e. DSN settings? Secondly, as
> users have to login before accessing my site would I simply create a
> postfuseaction property in my login circuit.xml and set my user
> specific session variables there? And if I am thinking correctly logic
> then suggests that I can use a prefuseaction property in circuit.xml
> for initialising thigs that I need to have access prior to my
> fuseaction page being loaded, i.e. retrieving data from the database
> required for the requested fuseaction? 

>  
> Andy McShane
> Head of Development
> Scout7 Ltd
> Acorn House
> 22 High Street
> Sutton Coldfield
> West Midlands
> B72 1UX
>  
> Tel: +44 (0) 121 354 7770
> Fax: +44 (0) 121 354 4245
http://www.GrokFusebox.com
"Fusebox 4 & FLiP: Master-Class ColdFusion Applications" 
Now available at ProtonArts.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6608
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to