Content-Disposition for my template?

Author Message

Ivan Švogor

Thursday 26 May 2011 6:28:00 am

Hi!

I am trying to create a downloadable file that is autogenerated. Like rss, when you use custom layout. You create a layout.ini config and you get a nice output of whatever you want (RSS, iCal format or whatever). I would like to download this. If I'm using .php file, you simply set Content-Disposition header echo out whatever content, and user can download it. Is there a similar way to do this in ezPublish?

(I've tried out custom headers, but it is not ment for this purpose, or I don't understand it - can some one clarify?)

tnx

Steven E. Bailey

Thursday 26 May 2011 9:18:05 am

This is trivial if you get the content through an extension - I've done many to output xml,vcards etc... but, I don't think you can change the content disposition from a template.  It's always AFAIR coming from php.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Marko Žmak

Thursday 26 May 2011 9:25:45 am

If you don't want to make an extension you could use the wrap operator:

  • http://projects.ez.no/wrap_operator

to execute the header() PHP function.

P.S. I would advise you caution when using the wrap operator, and not to get carried away with it.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Ivan Švogor

Thursday 26 May 2011 2:21:07 pm

How about go into index.php, and intercept the echo that writes out the page. Search for my custom tag, in my template e.g. <downloadable/> and if i find this, printout disposition header, and if not, carry on with page? - how bad is this quick fix on performance? (I did it, as a temporary solution, I will tryout wrap_operator)

Marko Žmak

Thursday 26 May 2011 3:05:25 pm

"

How about go into index.php, and intercept the echo that writes out the page. Search for my custom tag, in my template e.g. <downloadable/> and if i find this, printout disposition header, and if not, carry on with page? - how bad is this quick fix on performance? (I did it, as a temporary solution, I will tryout wrap_operator)

"

It's not only performance issue, but the fact you are hacking the files of eZP installation. It's not really a clean way and you'll have to watch out for upgrades...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.