Saturday, May 5, 2012

Call another controller paginate

Hello all,

I have tow controller, with name of asycontroller, and askcontroller.

class saycontroller extends AppController
{
        var $name = 'Asks';
var $helpers = array('Html', 'Form', 'Session', 'Time', 'Paginator');
var $components = array('Session', 'Auth', 'RequestHandler');
var $paginate = array(        
'fields' => array('Ask.id', 'Ask.question', 'Ask.user_id'),        
'limit' => 10,                
'order' => array( 'Ask.id' => 'desc')
);


        function all()
{
$ask = $this->paginate();
if (!empty($this->params['requested'])) 
{            
return $ask;
   } 
   else 
   {
    $this->set('askList', $ask);
  }
}
}

Now from my ask controller i call all action with the help of "requestAction"

$askList = $this->requestAction(array("controller"=>"Ask","action"=>"all"));

but i am not able to access all pagination value of my saycontroller/all.

How can i access paginate and of my saycontoller to askcontoller.

Please help me.

I have try some solutions but i am not success with that

(1)

        function index()
{
$this->loadModel('Ask');
$askList = $this->Ask->paginate('Ask');
//$askList = $this->requestAction(array("controller"=>"Ask","action"=>"all"));
$this->set("askList",$askList);
}

--
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: