On Oct 9, 1:20 am, "Dr. Loboto" <drlob...@gmail.com> wrote:
> Move $this->images values assign in separate method and call it both
> in getMedia() and getImages(). If I remember right, cake creates new
> controller instance on each requestAction.
>
> On Oct 9, 11:35 am, armen <oldar...@gmail.com> wrote:
>
I was trying to avoid accessing the database more than once, to speed
things up or be more efficient.
But thanks I guess that's what I'll have to do. Thank you very much
for the reply.

> > I think you can tell I'm a newbie from my question.
> > I have a controller like so:
>
> > class MediaController extends AppController {
>
> >         var $name = 'Media';
>
> >         var $images = array();
> >         var $panoramas = array();
> >         var $videos =  array();
>
> >         function getMedia() {
>
> >                /* assigns some values to the three variables by doing
> > some logic */
>
> >                 $this->set('images', $this->images);
> >                 $this->set('panoramas', $this->panoramas);
> >                 $this->set('videos', $this->videos);
> >                 return true;
> >         }
>
> >         function getImages() {
>
> >                 debug($this->images);  /* it's EMPTY!?
> >                 return $this->images;
> >         }
>
> > }
>
> > When i requestAction the getMedia, and when i debug the values in the
> > variables are set. But afterward when i call getImages to return the
> > values, the variable is empty!   I'm doing this via a different .ctp
> > file that belongs to another controller. What am i doing wrong?
> > -Armen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to