Why from the view? Why not just the correct 
Controller::
 set('data' , $this->Model>getData()); 

and in the model:: 
function getData() {

return $this->MyModel->find('all');

}

-----Original Message-----
From: AD7six [mailto:[email protected]] 
Sent: Friday, January 21, 2011 8:41 AM
To: CakePHP
Subject: Re: Querying the database in a view



On Jan 21, 12:35 am, Unflexible <[email protected]> wrote:
> Hello.
>
> You can create own Helpers and used needed queries to model through them
>
> http://book.cakephp.org/view/101/Creating-Helpers
> class MyHelper {
>
>    public function myQuery() {
>         App::import('Model', 'MyModel');
>         $this->Menu = new MyModel;
>         $this->data = $this->MyModel->find('all');
>         // create output....
>         return $output;
>    }
>
> }

Hideous.

-- 
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to