Thinking along the lines of Hal's approach to subfuses, I thought of this
custom tag:
<!--- index.cfm ------------------------------------->
<cfinclude template="app_globals.cfm">
<cfparam name="attributes.fuseaction" default="hello">
<cf_subfuse fuselevel="1">
<cf_bodycontent>
<cfswitch expression="#request.fuseaction#">
<cfcase value="products">
<cfinclude template="products/index.cfm">
</cfcase>
<cfcase value="hello">
<cfinclude template="dsp_hello.cfm">
</cfcase>
<cfdefaultcase>
</cfdefaultcase>
</cfswitch>
</cf_bodycontent>
<cfinclude template="app_layout.cfm">
<!--- subfuse.cfm ----------------------------------->
<cfscript>
if (listlen(caller.attributes.fuseaction, ".") lt attributes.fuselevel) {
request.fuseaction = "";
} else {
request.fuseaction =
listgetat(caller.attributes.fuseaction,attributes.fuselevel,".");
}
</cfscript>
-------------------------------------------------------
Subfuse.cfm creates the variable request.fuseaction which is the fuseaction
for the current fuse (directory). The only attribute for the tag is
"fuselevel" which is how many directories deep your circuit is, which
respectively, will be the position in the list where your current fuseaction
is at.
In my example, if the fuseaction was "products.featured", the Products Fuse
above would have:
<cf_subfuse fuselevel="2">
This would make the current fuseaction (request.fuseaction) for the Products
Fuse would be "featured".
The disadvantage of using ListFirst() and ListLast() is that you're limited
to how many subfuses you can have. With this, you can have as many as you
want, all you have to do is set the fuselevel in the subfuse tag. The
custom tag also gives your index.cfm a little more neatness (rather than
doing functions directly in index.cfm).
The reason I like Hal's method so much is because you don't have to worry
about your paths. Links can always use the universal format (point directly
to index.cfm) rather than using relative (../../index.cfm) or absolute
(/fusebox/index.cfm) format.
If you wanted to point directly to a subfuse (mysite.com/products/), do
this:
<cfdefaultcase>
<cfinclude template="url_FeaturedProducts.cfm">
</cfdefaultcase>
The cflocation tag in url_FeaturedProducts.cfm would redirect the user to:
#request.webroot#/index.cfm?fuseaction=products.featured
Anyone see potential here? Please let me know if I'm missing something, but
this seems like a simple approach to subfuses.
Thanks,
Brad
------------------------------------------------------------------------------
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.