On 3/7/07, Jochem wrote: > > Robert Rawlins said: > > > > The first element that confuses me is this use of 'views' and > > how I should be applying them to me project. Should I be creating a > > view for every page in my application, or is the idea that each view > > forms a 'widget' and then pages can be assembled from several > > views? > > You can do both.
I do both. But this is my hardest area-- separating the view from the code, as some code almost always has the same view, and I like to just call a function to spit it out formatted where I want it. I hear people go "view stuff in a CFC! Yeeech!" so my mentality hasn't quite got this aspect, I reckon. (other than: a simple refresh works with a cfm file, but I gotta re-init for objects- yup, I'm getting there fast ;) For instance, my "actionpacks" add their "view" directories when the controller is init-- that's the closest I've come so far to keeping with the basic idea yet avoiding adding redundant text. :-/ .... > > Next I wanted to quickly cover the process of retrieving query data > > into my view. On occasion I find myself needing un-manipulated query > > data in my views, is it 'proper' of me to have my controller > > speak directly to the ORM and collect that? Or should I always > > request it through my model? > > I would recommend putting an object in your model that returns queries. And the funny thing is how easy it is to get around "blocks", as in the above example. I keep using getMG().getORM() type stuff, which for sure is a no-no, but hell, isn't that part of the reason we use MG? Eh... > Another quick point with regards to controllers, how do you guys > > deal with separating your controllers? Should I be building them per > > task? So one controller for my Shopping Cart, one for my Reporting > > and another for User Information and so forth? > > That is pretty much what we do. Me too. And I do the same with the coldspring file, when it's too big, or the reactor file, when it's too big. Sometimes I start out with 'em all separate, if I know it's gonna be a big project (like any aren't ;). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2. Free Trial http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272104 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4