>> Then of course, there's cfinclude... ASP has no means of
>> dynamically
>> including content, which is a big advantage in cf, but in
>> most cases I
>> don't
>> see cfincludes taking advantage of the fact that the
>> template attribute is
>> dynamic. I see a lot of the FuseBox <cfswitch> method...
>>
>> <cfswitch expression="#fusebox.fuseaction#">
>>      <cfcase value="blah">
>>              <cfinclude template="blah.cfm">
>>      </cfcase>
>>      <cfcase value="foo">
>>              <cfinclude template="foo.cfm">
>>      </cfcase>
>>      <cfcase value="bar">
>>              <cfinclude template="bar.cfm">
>>      </cfcase>
>> </cfswitch>

> I've been wondering recently why Fusebox uses a cfswitch
> at all rather than
> simply using a file structure. To me surely
> fuseaction=accounts.editdetails
> could map to something like
> /accounts/editdetails/index.cfm without the need
> for any cfswitch. So the fuseactions and the fusebox (the
> cfswitch) would
> effectively be one and the same.

> This is more like what you do, isn't it Isaac?

> I'm sure they have a good reason.

Yea, that's a lot more like the way my applications usually map out
(although it's more likely to include /accounts/index.cfm and then from
there include editdetails.cfm) -- and it's not necessarily always exactly
the same method. I don't have a pre-built app framework that all my projects
start with, probably largely because most of the projects I work on aren't
initiated by myself.

Probably the larger reason for using the <cfswitch> in the index.cfm file is
that it allows you to include multiple templates in a given case statement,
i.e.:

<cfswitch>
        <cfcase value="search">
                <cfinclude template="qry_search.cfm">
                <cfinclude template="dsp_itemlist.cfm">
        </cfcase>
        <cfcase value="listbyname">
                <cfinclude template="qry_listbyname.cfm">
                <cfinclude template="dsp_itemlist.cfm">
        </cfcase>
</cfswitch>

My inclination would be to simply write the dsp_itemlist.cfm include
template and then write individual containing templates with the query
embedded (or another include if it's a commonly used query) and then include
the dsp_itemlist.cfm template within that target template.

I know that there are also some things that FB3 (I don't remember or know
all that much about FB2) does that would be difficult to simulate using
filesystem mappings like this. The one that stands out in my mind is the
circuits structure defined in fbx_circuits.cfm -- which is something that I
would replace with a mapping like this. The advantage of the fbx_circuits
file over the mapping alternative is that it allows you to create mapped
paths to circuits which may not necessarily be contained one level down in
the file system in the currnet circuit. Take for instance this file
structure:

www.mysite.com
        admin
                content
                products
        members
        polls
        security

the admin circuit for instance in this case could map admin/members to
/www.mysite.com/members/ and all circuits can map secuirty to
/www.mysite.com/security/ ... polls would probably also need admin and
admin/polls/ can be mapped to /www.mysite.com/polls/ while members/polls/
can be mapped to the same place, since you want members to be able to vote
on them.

This encapsulates all of the code for members and polls so that it's all in
one place, rather than having some code in the circuit and some other admin
code in the admin section or elsewhere... Without using this sort of
structure in most cases actually the polls app wouldn't be a circuit of its
own, but rather there would be polls code in probably /members/polls/ and in
/admin/polls/ ... My inclination on the other hand is to just encapsulate
all the polls code anyway and implement it as a custom tag that's called
from /www.mysite.com/_tag/ ...

This could be done using the circuit as a custom tag in FB, although you
have to be careful when you do that... I once attempted to use the security
circuit as a custom tag in an application but because any given page might
call the security custom tag 3-8 times the added overhead of fusebox made it
too inefficient to use it that way, so I had to resort to having a custom
tag for security separate from the circuit.


s. isaac dealey                954-776-0046

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to