Hang on just a bit, Brian. John Q has been working on something that
will make MVC much easier and solve the problems you've run into. He's
putting the finishing touches on it...

-----Original Message-----
From: Brian Kotek [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, February 23, 2002 3:34 PM
To: [EMAIL PROTECTED]
Subject: RE: MVC Pattern



Patrick McElhaney wrote:
> > Brian wrote:
> > 
> > Patrick McElhaney wrote:
> > > parent
> > >   model 
> > >     products
> > >     orders
> > >   view 
> > >     catalog
> > >     cart
> > >     checkout
> > >     orderstatus
> > >   controller
> > >     shopper
> > 
> > Patrick, I think I see what you are saying.  But where in
> > this example  would you handle the adding/changing quantity/remove 
> > functions of the  shopping cart?  Add another folder under model 
> > to handle that?
> I didn't include the admin functions, but I would probably
> create another controller circuit for administration. Then I'd have a 
> view for updating the inventory. I could still use the products
> model circuit, and just add add/update/delete fuseactions.
> 
> 
> > > Pass the query into the circuit as an attribute.
> > > 
> > > <cfmodule
> > >     template="#fusebox.rootpath##self#
> > >     fuseaction="catalog.showItems"
> > >     items="#attributes.items#">
> > 
> > Not sure I understand what you mean here...wouldn't the items
> > attribute  of the cfmodule have to be something like: 
> > items="#caller.myqueryname#"?
> 
> You'd have #attibutes.myQueryname#, because the query
> would be passed in as an attribute.
> 
> Here's a more complete example. Say the products circuit has a 
> fuseaction called "getItemsInCategory." It would run a query to get 
> the items in a category, and pass it up to the caller, using a 
> variable name specified by the caller.
> 
> <cfinclude template="qry_itemsInCategory.cfm">
> <cfset "caller.#attributes.return#" = attributes.itemsInCategory>
> 
> The controller circuit (shopping) would call that fuseaction and
> then pass the query on to the view circuit (catalog). Here's what
> the fuseaction in the controller circuit would look like. 
> 
> <cfmodule
>   template="#fusebox.rootpath##self#
>   fuseaction="products.getItemsInCategory"
>   category="#attributes.category"
>   return="attributes.itemsInCategory">
> 
> <cfmodule
>   template="#fusebox.rootpath##self#
>   fuseaction="catalog.showItems"
>   items="#attributes.itemsInCategory#">
> 
> Now the catalog.showItems circuit would have a query called
> itemsInCategory in the attributes scope. 
> 
> Does that make sense?
> 
It does make sense Patrick.  I was just hoping to get away from the 
longer notation of "attributes.itemsInCateogry.itemID" or similarly 
"request.itemsInCateogry.itemID"...same goes for using the caller scope.

 Again, I'm not sure there is a way around this beyond writing code to 
copy this into the local variables scope inside the circuit being called

via CFMODULE.  And that, to me, is just getting too complicated.  So it 
looks like it stands that any way you slice it, you're going to have to 
prefix your query and query items with some scope, be it request, 
caller, or attributes.

It seems like with MVC the mindset you must have is quite different from

the regular old 'fusebox circuit' mindset.  It's going to take some time

for me to get used to that, I think.

Thanks,

Brian


---

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================



Reply via email to