I am trying to make my first custom component and am quickly running
into problems. I am making a PhotosComponent that will get all the
photos for a particular page. I have the following:
<?php
class PhotosComponent extends Object {
var $controller = true;
function getParkPhotos($which) {
$photos = $this->Photos->findAll("WHERE id = $which");
return $photos;
}
}
?>
then in my Controller I have:
Class SkateparksController extends AppController {
var $name = 'Skateparks';
var $components = array("Rating","Photos","YahooWeather","PhpThumb");
var $helpers = array("Map");
var $useTable = 'skateparks';
var $layout = "skatepark";
function index() {
$parkInfo = $this->Skatepark->findByurl($this->params['url']);
$this->set("parkInfo",$parkInfo);
$this->Photos->getParkPhotos($parkInfo["Skatepark"]["id"]);
}
// More code....
But when I do this, I get Fatal error: Call to a member function on a
non-object. I know that I'm probably going about this in the
completely wrong way so if someone could help me out, it would be most
appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---