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: [email protected] [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 [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
-~----------~----~----~----~------~----~------~--~---