Friday, June 29, 2012

Re: Is there a lighter weight alternative to requestAction?

On Friday, June 29, 2012 12:30:39 AM UTC-4, Ilie wrote:
Hello,

Another way to do this is to have one controller requestAction to fetch (as array or objects) all the data you need to render your modules, then using Elements or View Blocks to do the actual rendering of the modules.
Yes, that's exactly what I'm doing to assemble the modules. With view blocks, we can divide the page into panels and create a view block for each panel, so by specifying a panel attribute in the module, we can render each module in the specified panel and assemble the layout in the common view. That part is working very well.

However, suppose the content editors want to write an article about farmers markets and they want to display a list of farmers markets in the local area, we can tell them to embed something like {/organizations/list/tag:farmers-markets/radius:10/count:5} in the content. Or somewhere else they want a list of music events, then we would tell them to embed {/events/list/tag:music/radius:75/count:10}. So by passing that URL to requestAction, it will call the appropriate controller and action and return the rendered content. It keeps the code simple and modular, in the spirit of MVC. We are doing a form of that in Cake 1.1 right now but the rendering time is a bit longer than I would like. I suppose we can create our own version of the dispatcher, though I'm not sure of the benefit vs. maintainability. 

As you say, caching is important and we do do that, so really it is the first time hit that counts.

Mark

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: