Hi all.
I've done plenty of searching and been unable to find a solution yet. I'm also
fairly new to Cake, but not to PHP. I have ajax pagination working from the
currently-view controller/model. However, if I attempt to paginate a list that
comes from a different model/controller, I only get 1 result.
>From Hardware, I get a properly paginated list of hardware items. Hardware has
>a belongsTo relationship to HardwareType and Location. From Location, I want
>to include a paginated list of hardware items. If I call the same method from
>LocationsController as I do in HardwaresController, I only get 1 result.
<?php
class HardwaresController extends AppController
{
public $components = array('RequestHandler');
public $helpers = array('Js'=>array('Mootools'));
public $paginate = array(
'Hardware' => array(
'limit' => 3,
'order' => array(
'Hardware.name' => 'ASC'
),
),
);
public function index () {
$this->set('hardware', $this->listing()); // This works as expected
}
public function listing () {
return $this->paginate('Hardware');
}
}
class LocationsController extends AppController
{
...
public function view ($id) {
...
App::import('Controller', 'Hardwares');
$Hardwares = new HardwaresController;
$Hardwares->constructClasses();
$this->set('hardwares', $Hardwares->listing()); // This is only 1 result
}
}
class Hardware extends AppModel
{
public $name = 'Hardware';
public $belongsTo = array('HardwareType', 'Location');
public $order = array('Hardware.name ASC');
...
}
?>
Can anyone explain why I'm only getting a single result (which is the actual
first result) and/or please provide some assistance on how to resolve the issue?
Thanks in advance.
~Philip
http://lonestarlightandsound.com/
"innerHTML is a string. The DOM is not a string, it's a hierarchal object
structure. Shoving a string into an object is impure and similar to wrapping a
spaghetti noodle around an orange and calling it lunch."
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en