If you can move this code into model it will be better then requestAction.
On Oct 9, 4:30 pm, armen <[email protected]> wrote: > On Oct 9, 1:20 am, "Dr. Loboto" <[email protected]> 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 <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
