Correction: the <cfswitch
expression="#GetToken(attributes.fuseaction,2,'.')#> requires a prefix. So
you would need to change the <cfswitch> if you're using it in a nested
environment.

-----Original Message-----
From: Hal Helms [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 08, 2000 4:31 PM
To: [EMAIL PROTECTED]
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