Your Open Source

 
Related Posts

call the another controller function in cakephp

In cakePHP,Use the requestAction() function if you need to call a one method from the another controller, The example code given below,



class NotesController extends AppController
{

function test()
{
$damu= $this->requestAction('/Stores/read');
$this->set('data', $damu);
}
}
==================
class StoresController extends AppController
{

function read()
{
$str= "hai from controller2";
return $str;
}
}

  • hits 2787
  • datetime Feb 25 09 09:14:41
  • author Damu
  • rating

Rating : 12345
Tags :- PHP

Answers

Dogo
Aug 06 10 05:19:59
Quote from the Cookbook:

If used without caching requestAction can lead to poor performance. It is rarely appropriate to use in a controller or model.

Your Name:
Your Answers :
<> is a code tag
Preview
Enter the verification code: