If my first inclusion under a fuseaction yields a conditional result that
helps determine the course of action for the rest of the fuseaction, I
usually prefer to let the index.cfm handle the redirection.  Though I too do
not like complex index.cfm files, I would see a few best practices that
would result in this technqiue:

1.      Just looking at your index.cfm explains your logic flow
2.      You don't have to dig very deep to follow your logic
3.      If you call that same initial include from some other location because
you want it to be resusable, you may not want the conditional it contains to
behave the same way each time (though setting an XFA variables before hand
kind of negates this...for newcomers, it is still a little easier to see the
logic flow in one simple to access place).

If all the first condition needs to do is redirect, I would rather see an
xfa set and let the initial include redirect as needed.  However, I usually
run into situations where one or more conditions simple determine the next
set of includes.  A good example would be adding ot your original example:

        Action File gets included
                Inside Action, a Query is done
                Based on the query results, some flag gets set or does not get set
        Conditional in index.cfm is seen and processed
                Either another query is run, then a displayer
                or
                Perhaps just a display is included

Here, the conditional processing in the index.cfm is a result of one or more
conditions that may be met inside your first action file.

Anyway, ramble ramble,  a clear case can be made for both methods depending
on how complex you are willing to let your index.cfm file get.  Some of mind
have gotten nasty because of how I wanted to reuse certain bits of code.
Sometimes I am able to clean it up quite a bit using xfa's inside the
initial action processing..it varies.

Mike Craig

-----Original Message-----
From: Hal Helms [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 09, 2001 8:19 AM
To: Fusebox
Subject: Surveying the community


Folks,

Question on how you handle queries: Some people always include query files
in other files, like this in actDoSomething.cfm:

<cfinclude template="/Queries/aQuery.cfm">

Others let the fusebox itself handle this, like this:

<cfcase value="doSomething">
  <cfinclude template="actDoSomething.cfm">
  <cfinclude template="aQuery.cfm">
</cfcase>

My question is this: if you use the second method, how do you handle the
situation where you would only want to call "aQuery.cfm" IF a variable in
"actDoSomething.cfm" was set to true? Do you do it in the fusebox, like
this:

<cfcase value="doSomething">
  <cfinclude template="actDoSomething.cfm">
  <cfif includeQuery>
    <cfinclude template="aQuery.cfm">
  </cfif>
</cfcase>

Or do you do something else? I'm just trying to see how different developers
handle this situation.
Hal Helms

Team Allaire

[ See www.halhelms.com for info on training classes ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to