On 4 abr, 07:01, "Chowsapal" <[EMAIL PROTECTED]> wrote:
> I've also used:
>
>  $this->set('cities', $this->{$this->modelNames[0]}->query('SELECT id,
> title FROM cities as City'));

All of these suggestions will give you a php error instead of a cake
error message if cake detects anything is wrong (anywhere in the app),
as if cake is about to present an error message models aren't loaded.

wise to do:

if (isset($this->NameOfModel)) {
$stuff = $this->NameOfModel->findAll();
} else {
$stuff = array();
}
$this->set('stuff',$stuff);

Or something else that will still allow cake to tell you what's
wrong :). Also as it's for presentation stuff, better placed in
beforeRender, as otherwise for form submissions or other actions that
redirect the code is executed needlessly.

hth,

AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to