It has been a while since I've been working with CakePHP, sad I know, but had other projects on the go. I've been working out for a while a different and more consistent method of routing requests and serving up pages. I would enjoy your response and thoughts on this.
The objective is to have a universal way of rendering pages. Currently, the rendering process is different between a full page request, an element / requestAction process, an ajax update returning the render html, and a ajax update return just data which then updates the client side html using javascript.
I'll illustrate this solution via an example.
- A full page request comes in for /controllerA/actionB/.
- Instead of the request going to ControllerA->ActionB(), the request goes to PageRendererX->RenderRequest().
- PageRendererX->RenderRequest() looks up the elements (with configuration variables) it needs to render for page /controllerA/actionB/ and what zones of the html it needs to render them in.
- View renders the request by running through the zones and processing each allocated element.
- Each element then fetches its data using requestAction and passing the required variables to the action.
- Each action simple returns the data as usual and the element renders its portion of code.
If this process was followed, it would allow the following:
- Any element on the client side could be automatically ajax updateble.
- Any element javascript code could update the html via an ajax data request. This simple routes to an AjaxRender controller on the server, which simply processes and returns the data similar to how requestAction would to an element.
The process would most likely need a universal handler for the communications between client and server. For example, if a controller or element is adding javascript to the page, this needs to be understood by the handler, so it can insert/execute the javascript on the client side as needed.
Using this process potentially will lead to simpler code, easier rendering capabilities, and leaves the rendering very adaptable.
I have not considered the performance impact of this.
What are your thoughts?
-- 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:
Post a Comment