Hi Jared, thank you, but it did not worked, although I have php5 installed. Is there an other way?
Kind regards, volka On 8 Jan., 22:43, Jared <jdai...@gmail.com> wrote: > The foreach loop is working on a copy of $travelogue. So you either > need to pass it in by reference by doing: > foreach ( $travelogues as $travelogue){ > ...} > unset($travelogue). > > This will only work in php5. > > volka wrote: > > Hi there, > > > I have the following index() method in my controller: > > > function index() { > > $travelogues = $this->Travelogue->find('all'); > > $i = 0; > > foreach ( $travelogues as $travelogue): > > if (!empty($travelogue['Travelogue']['gallery'])){ > > $travelogues[$i]['Images'] = "abcdef"; > > debug($travelogues); > > } > > $i++; > > endforeach; > > $this->set('travelogues', $this->paginate()); > > } > > > The purpose is to append a key called 'Images' to $travelogues. > > The debug($travelogues) shows that it worked. > > > But debugging $travelogues in my view index.ctp shows no 'Image'. > > What did I do wrong here? > > > Thanks for any help. > > > Kind regards! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---