You are welcome, happy weekend! On Fri, Oct 24, 2008 at 1:59 PM, Liebermann, Anja Carolin <[EMAIL PROTECTED]> wrote: > > Thank you very much Dardo! > > I finally got it! > > I do it like this: > function document_start($filename){ > $this->render('document_start'); > $this->writetoharddisk($filename, $this->output); > $this->output = ''; > } > > You made the week end with a success! Thanks a lot to all for your help! > > Anja > > -----Ursprüngliche Nachricht----- > Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Dardo > Sordi Bogado > Gesendet: Freitag, 24. Oktober 2008 17:53 > An: cake-php@googlegroups.com > Betreff: Re: Write view output to file - best MVC approach? > > > Every time you call $this->render() in the controller it's output is appended > in $this->output. > > Call $this->render(), get the output from there or from $this->output and > save that, the empty $this->output. > > HTH, > - Dardo. > > On Fri, Oct 24, 2008 at 1:49 PM, Liebermann, Anja Carolin <[EMAIL PROTECTED]> > wrote: >> >> Hi Dardo, >> >> Thanks for your hint! What would be the correct syntax? I am not sure if I >> am doing it right because now my file stays empty. >> >> Example in the controller: >> function document_start($filename){ >> $this->writetoharddisk($filename, $this->output); >> } >> Anja >> >> -----Ursprüngliche Nachricht----- >> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im >> Auftrag von Dardo Sordi Bogado >> Gesendet: Freitag, 24. Oktober 2008 17:22 >> An: cake-php@googlegroups.com >> Betreff: Re: Write view output to file - best MVC approach? >> >> >> Get the value from $this->output (in the controller), also empty that to get >> only the current view. >> >> On Fri, Oct 24, 2008 at 11:11 AM, Liebermann, Anja Carolin <[EMAIL >> PROTECTED]> wrote: >>> >>> Hi Djiize, hi everybody >>> >>> At the moment I try your idea with $this-render(). >>> >>> I wrote a function which will write me a string to a file on harddisk. The >>> string is $this-render() and it works. >>> >>> To avoid my memory problem I divided the output in several functions >>> which have their own view like Function document_start, document_end, >>> elements_in_the_middle, more_elements_in_the_middle, which go to >>> document_start.ctp, etc.... >>> A function "start" calls the others as it loops through my data so I don't >>> have too big data arrays with my model data because I can set conditions on >>> teh find method. >>> At the end of each function I write $this-render() to harddisk. >>> >>> So far it works, BUT... (there had to be something, eh?) The content >>> of $this->render seems to add up instead being filled new in every >>> function. I tried to unset it (error message) or set it to '' because it >>> isn't writeable. >>> >>> Example: >>> >>> function document_start($filename){ >>> $this->writetoharddisk($filename, >>> $this->render('document_start')); >>> } >>> >>> Is there any method to set if back? Or any other idea to get the rendered >>> views to my file? >>> >>> As always: Thanks in advance for any help and hints! >>> >>> Anja >>> >>> >>> -----Ursprüngliche Nachricht----- >>> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im >>> Auftrag von djiize >>> Gesendet: Mittwoch, 22. Oktober 2008 16:55 >>> An: CakePHP >>> Betreff: Re: Write view output to file - best MVC approach? >>> >>> >>> in Controller code, a call to $this->render() returns the content of >>> the view HTH >>> >>> On 22 oct, 15:49, "Liebermann, Anja Carolin" >>> <[EMAIL PROTECTED]> wrote: >>>> Hi everybody, >>>> >>>> I make good progress with my xml-export. >>>> Since I expect the output to become very big, I would like to write >>>> the resulting view rather to the harddisk to download later than >>>> show it on the screen. >>>> >>>> Now my questions: >>>> In my controller I have an function which could write strings in a file. >>>> But my strings are composed in my view! >>>> >>>> What is the best approach to stay in the MVC world? >>>> >>>> Call the write function form the view? Or transfer all foreach logic >>>> to the controller? If I do the second what do I do with strings I >>>> have put in elements? >>>> >>>> If I want to avoid an overflow in my RAM do I have to flush >>>> something in between? >>>> >>>> Thank you for your opinion and any hints! >>>> >>>> Anja >>> >>> >>> > >>> >> >> >> >> > >> > > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---