Why not simply have a relationship Statepark hasMany Photo?
Need not bother with the component, as a side note your component is missing
the Photo Model.
HTH
Tarique
On Sun, Apr 6, 2008 at 12:17 PM, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
> 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.
>
>
>
>
> >
>
--
=============================================================
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=============================================================
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---