Nat Papovich wrote:
> But this can be easily overcome by checking for the existence of xfa's in
> the fuse before cflocationing, and only providing xfa's to fuses that you
> want to be able to cflocate out of:
> <cfcase value="action2">
> <cfinclude template="act_page1.cfm">
> <cfinclude template="act_page2.cfm">
> <cfset xfa1="blah">
> <cfset xfa2="blah">
> <cfinclude template="act_page3.cfm">
> </cfcase>
This is going to quickly get ugly. Sometimes your act files would need
an xfa depending on the current data. Look at this:
<cfcase value="ViewOrder">
<cfinclude template="qry_maxorder.cfm">
<cfinclude template="qry_order.cfm">
<cfinclude template="url_choosebilling.cfm">
<cfinclude template="url_chooseshipping.cfm">
<cfinclude template="act_calculateshipping.cfm">
<cfset xfa="blah">
<cfinclude template="dsp_vieworder.cfm">
</cfcase>
Explanation of fuses:
<cfcase value="ViewOrder">
<!--- a couple queries needed for the act/url/dsp files below --->
<cfinclude template="qry_maxorder.cfm">
<cfinclude template="qry_order.cfm">
<!--- checks to see if the order requires a billing address
checks to see if a user has already specified billing address
If this fails it redirects them to /members/addresses/index.cfm--->
<cfinclude template="url_choosebilling.cfm">
<!--- checks to see if the order requires a shipping address
checks to see if a user has already specified shipping address
If this fails it redirects them to /members/addresses/index.cfm--->
<cfinclude template="url_chooseshipping.cfm">
<!--- simply recalculates their shipping depending on the the address
they
specified after returning from the url_chooseshipping.cfm
redirection--->
<cfinclude template="act_calculateshipping.cfm">
<!--- displays the order, the xfa makes sense here--->
<cfset xfa="blah">
<cfinclude template="dsp_vieworder.cfm">
</cfcase>
Could this be done with XFAs in act files? Sure, but your not going to
reduce the files because url_choosebilling.cfm/url_chooseshipping.cfm
get reused all over the place, so I would end up with this:
<cfcase value="ViewOrder">
<cfinclude template="qry_maxorder.cfm">
<cfinclude template="qry_order.cfm">
<cfset xfa.billing="...">
<cfinclude template="act_choosebilling.cfm">
<cfset xfa.shipping="...">
<cfinclude template="act_chooseshipping.cfm">
<!--- uh oh, will this redirect or not??!!!! --->
<cfinclude template="act_calculateshipping.cfm">
<cfset xfa="blah">
<cfinclude template="dsp_vieworder.cfm">
</cfcase>
This is even more complicated code that does the same thing! Except you
get screwed in the act_calculateshipping.cfm because you needed to set
an xfa for act_choosebilling/act_chooseshipping but but not for
act_calculateshipping.cfm.
Sure, you could kludge your way around it, hell it probably wouldn't
even be a problem because you'd name the XFAs different. But the
reality is that act_calculateshipping.cfm is a calculation script (i
know because i wrote it) which means that it's almost always going to
end up being run in connection with some other script. There just isn't
a need for ANY redirection in act_calculateshipping.cfm. So why put one
in with an cfif statement around it when it's only going to get called
from a mistake?
I'm just not a big fan of redirection in act files. It makes reuse a
pain in the neck when it doesn't need to be. URL files are easy to
explain to a newbie, XFAs in act files are not.
Steve Nelson
Online Web Development Training:
http://www.SecretAgents.com/training
(804) 825-6093
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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