> Thing is I know I'm not supposed to put any presentation 
> stuff in them. But say for example I had a poll cfc. I can 
> run all of the actions through the CFC fine, but why not add 
> some optional basic html (i.e. form & results) so that if 
> wanted, the whole poll could be encapsulated within the one 
> file and in theory could be added to any site with just a 
> couple of lines of code. If the basic form & results didn't 
> suit I could then go for a tailored option for the sites that 
> needed it but all would still be based on the one cfc. 
> 
> So would this a bad thing and why?

I think there are always exceptions to the rule on this, in our e-Commerce
system, there are several places where I would want to render a shopping
basket and I need to render it in both HTML and text only versions. If I
were to do these sections of code outside of the CFC's then it would be a
nightmare however, having a couple of functions in the basket CFC to
renderHTMLBasket and renderTEXTBasket means that I have complete consistency
across the site and I only have to bug fix/maintain a couple of functions.

What those functions *don't* do is output any HTML or TEXT direct to the
calling page, instead, I use <cfsavecontent and return the generated content
from the functions as a string. That way, I am still keeping the CFC's away
from direct interaction with the pages but I am generating a small amount of
content using those same CFC's.

HTH

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271990
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to