This is also the way I have been handling my sub-fuses.  I like using the
prefix in the switch statement of the main-fuse better than a list of
fuseActions for each sub-fuse (it seems to be a more abstracted structure
since the
main-fuse does not need to know all of the sub-fuses fuseActions).

The only problem with this is when I want to nest fuses more than one level
deep. If I am trying to use a fuseAction that is in a fuse two levels deep I
add a second prefix to the fuseAction.  Then just have the main-fuse strip
the first prefix and the first level sub-fuse strip the second prefix that
will then pass to the second level sub-fuse.  This seems to work okay.  In
each of my app_locals.cfm files I have a variables called
attributes.fuse_prefix that I prepend to each of my fuseActions.  Then if I
move the sub-fuse to a different place in my directory structure I can just
change the "fuse_prefix" variable and everything works fine.

Does anybody else handle this situation differently?  This seems to work
okay but I am wondering about other peoples solutions.

Thanks,

Bryan Ziel


----- Original Message -----
From: Hal Helms <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 08, 2000 4:30 PM
Subject: Nested fuseboxes


> A while back, someone asked about nesting fuseboxes and we had some
> discussion on that. I'm working on a book for Prentice Hall and in playing
> around with some sample code for it, I thought of something that might be
> helpful. I'm going to test it out to see if I like it, and thought you all
> might like to evaluate it.
>
> Here's a quote from the forthcoming book:
>
> The other approach to nested fuseboxes relies on using an abbreviated
prefix
> to help the main fusebox identify who the fuseaction belongs to. If I am
> working in the UserManger fusebox, I might give all my fuseactions a
prefix
> of UM with a separator:
>
> UM.loginUser
> UM_validateUser
>
> In the main fusebox, you then change your <cfswitch> statement so that,
> instead of looking for attributes.fuseaction, it looks for a prefix:
>
> <cfswitch expression = "#GetToken(attributes.fuseaction,1,'.')#">
>
> Your <cfcase> statements now only need send the action to the appropriate
> nested fusebox:
>
> <cfcase value="UM">
>   <cfinclude template="UM/index.cfm">
> </cfcase>
>
> The last thing to do is to code the nested fusebox so that it strips away
> the prefix.
>
> <cfswitch expression = "#GetToken(attributes.fuseaction,2,'.')#">
>
> The nice thing about this system is that it works whether you have
prefixes
> or not.
>
> <cfset myName = "hal.helms">
> #GetToken(myName,1,'.')#
> #GetToken(myName,2,'.')#
>
> <cfset myName = "hal">
> #GetToken(myName,1,'.')#
> #GetToken(myName,2,'.')#
>
> will both return "hal"
>
> Hal
>
> --------------------------------------------------------------------------
----
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to