Dear List,
Very new to cake, but learning the API way :-) I am using v1.2 and am
creating a website for my girlfriend's ratshelter ;-) Well, rather
rebuilding from a previous site.
Most of the static informational pages I serve via the pages
controller /pages/blahblah. I use a simple 3 column layout with the
main content in the middle. Now I want to be able to inlcude data from
a model in my layout, so that it is available in all pages in the
right column.
So I thought I'd make a helper:
class LocHelper extends Helper {
var $helpers = array( 'Html' );
var $uses = array( 'Location' );
function locationList() {
$ret = Location::findAll();
return $this->output(print_r($ret, true) );
}
}
Abbreviated for testing purposes.
I thought I'd use this in the layout file as folows:
echo $Loc->locationList();
(I included the helper in the $helpers array in my AppController)
But I get the following error when viewing the page: Fatal error: Call
to a member function on a non-object in my default.thtml file in my
app directory.
I am stuck. Took a while to figure out if and when to use helpers or
elements. Still not sure what the preferred way is to have a "module-
like" page with information in one layout/view from several models.
But I thought I'd figure this one out first :-)
Can anyone tell me how to get the info from my Location Model in a
default layout? Or am I missing the obvious?
Thanks,
Paul
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---