Articles tagged with requestAction

Optimizing your CakePHP elements and views with caching

By Tane Piper
As I have developed my CakePHP application, I have discovered new and useful functions every day - and today I want to talk to you about caching, and how easily it can be implemented. When I implemented it on my front page, I went from having 7 database queries down to 1.
[Read more]

Creating Reusable Elements with requestAction

By gwoo
This is a brief tutorial on using requestAction to produce reusable elements. Code samples for 1.1 and 1.2 are provided.
[Read more]

Using requestAction & custom layouts to add XHR functionality

By A.Doherty
This tutorial outlines a method for creating or modifying Cake apps that work swiftly for XHR(XmlHTTPRequest)-enabled clients and degrade well to non-XHR/AJAX (even javascript disabled) clients. The guidance provided here will be most suitable to newly converted Bakers. It simply outlines some of Cake's many flexible features and shows how using them in combination can bring rapid returns.
[Read more]

Ajax elements available anywhere

By Sami Radi

When I have chosen to work with Cakephp it was because of all these great features that we could use to create an ajax app easily. However, I had some problems to manage Ajax view elements like header, footer,... I figured out a solution that I would like to share with the community and have feedback about. (p.s : forgive me for my english, i'm not a native speaker)

Here's an overview of the problem. Ajax key feature is to smooth the user navigation by preventing page reloading through ajax requests. Let's say that you want to put an Ajax login into your website header. You need to be able to use the feature anywhere on the website.

After hours of readings i found out that to be compliant with cakephp MVC structure the process should be the following :

  • 1. Ajax call to current controller.
  • 2. request requested action from this controller or another controller.
  • 3. proceed with your algorithm.
  • 4. setting the values into the view that has to be rendered.
  • 5. render the view or element.
  • 6. end of Ajax call.

[Read more]