Sunday, January 4, 2009

Re: Return compressed XML

Thanks Adam! Using ob_start("ob_gzhandler"); in my beforeFilter worked
great.

On Jan 4, 6:41 am, Adam Royle <a...@sleekgeek.com.au> wrote:
> If you're sending unique data for each request, I wouldn't bother
> using the MediaView. Just output data in your views and set some
> custom headers.
>
> You can also find out about an easier way to gzip output in cakephp
> here:
>
> http://debuggable.com/posts/issues-with-output-buffering-in-cakephp:4...
>
> Cheers,
> Adam
>
> On Jan 4, 2:15 pm, ace2600 <TheOneAndOnlyBran...@gmail.com> wrote:
>
> > Hi,
>
> > I want to return unique compressed XML for each user request.
> > Something like this in the controller:
>
> > public function download()
> > {
> >     $filename = 'some_temporary_file_name.gz';
> >     $this->view = 'Media';
> >     $params = array(
> >               'id' => $filename,
> >               'name' => 'some_temporary_file_name',
> >               'download' => true,
> >               'extension' => 'gz',
> >               'path' => ''
> >     );
>
> >     // open file for writing with maximum compression
> >     $zp = gzopen($filename, "w9");
> >     // write string to file
> >     gzwrite($zp, $unique_xml_here);
> >     // close file
> >     gzclose($zp);
>
> > }
>
> > How can I create a unique file for each request and have the file be
> > deleted after the user downloaded it? I'm mostly concerned with the
> > deleting part unless there is a convenient CakePHP for the unique file
> > part.

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: