Hi Matt,
Now it works...i've inserted the table csutomers in the $uses var of
UsersController...
But the thing is not clear to me:can i use a controller that uses the
model already used by another controller? I mean..the model customer is
primarily used by the customers controller. I've created the User
controller just to display data under path like mydomain/users...
As you can see by the code below, I'm gathering data from two tables
that already have their own model and controller..
I guess this is not the right way to do things in Cake
This is my code
class UsersController extends AppController
{
var $name = 'Orders';
var $uses = array('Order','Customer');
var $components = array ('Pagination');
var $helpers = array('Html','Javascript','Pagination');
//var $scaffold;
//var $recursive=2;
function index()
{ $this->pageTitle = 'Area Riservata';
$this->layout = 'user';
if (empty($this->params['form']['nome']))
{
$criteria=NULL;
}
else{
$c_nome="%".$this->params['form']['nome']."%";
$criteria="Customer.name LIKE '$c_nome'";
}
$criteria="Customer.id = '2'";
list($order,$limit,$page) = $this->Pagination->init($criteria);
$data = $this->{$this->modelClass}->findAll($criteria, NULL,
$order,
$limit, $page);
$this->set('data',$data);
Thnx again for answer :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---