Paul,

I've been doing the exact same thing... well, not with a shopping cart, 
so not *eaxctly*, but still...
I've got a CFC that I call display.cfc. It's whole purpose in life is to 
generate screen layouts and return the HTML as a string to the calling 
page where I then display the content that was returned by the cfc.

So I've got a shell file (index.cfm/htm) and it has a menu bar at the 
top (jdMenu for jQuery). Items on this menu bar generate different 
screens (a password change screen, a user add screen, a title loan 
worksheet, etc.). Each screen is a function in my display.cfc. I call 
the appropriate method using AjaxCFC, and the returned html is then 
displayed inside of my "MainContent" div. I also use the cfsavecontent 
method to collect all that html into a single variable. The result is 
that my app switches between these screens seamlessly without having to 
refresh the page. Meantime most of the hard work is done by ColdFusion.

It's cool to see that I'm not the only one doing this sort of thing. :o)

Chris

Paul Vernon wrote:
>> 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
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion

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

Reply via email to