Search

A new Extension, “Downloadable Page Type” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

I’m glad to share my first symphony extension. It’s nothing too fancy, but hopefully it will be useful.

This will download any page that has a pagetype that begins with a dot ‘.’ (in others words a file extension). It sest the downloaded file’s name to the page handle + the extension page type. So if you’ve got a csv output, just give the page a type = ‘.csv’, and this will make it downloadable. I based this off Alistair’s content type mapping (since it worked with headers).

Right now it uses the page-handle for the filename, but it would be spiffy to use the last url param if it exists, so I may add that in the future. Also, it doesn’t set the content-type header; I’m not sure how important that is, but seems like it would be a good thing to do. To that end, this extension could probably be added to the content-type-mapping extension, and kill 2 birds with 1 stone.

Hardly tested, but seems to work. I’m pretty new at Git (and php for that matter) so any/all input welcome.

Github of my extension - Downloadable Page Type

Edit: Ok, I forked the content mapping extension and added this functionality, but the content-type headers don’t seem to be working (even with my additions commented out).

Edit 2: I’ve fixed this problem. Keep in mind that depending on the content-type you supply in the mapping, it may not be necessary to explicitly set the Content-Disposition using the ‘.’ prefix.

Github of my fork of the Content Type Mapping, with my fix and Download functionality described above.

Good idea! Looking forward to content-type-mapping + downloadable-page-type. Just what I need for my tutorials, where I am providing each entry as HTML, XML and text. I haven’t been able to use Content Type Mapping, since I’m running 2.0.2 and the extension required what used to be the integration branch, but is now release as 2.0.3.

Ok, I’ve integrated this feature into the content-type-mapping extension, and fixed what appeared to be a bug with the original. See 2nd link above for my fork of the content-type extension.

Does this extension extend to being able to output an entry as a word .doc file at all?

Or maybe a pdf?

No, it just sends the correct MIME type so that the browser interprets the content as the right file type. The actual content of the output is up to you.

You can generate .doc files from XML; you might give something like this a try (I didn’t really look at it). If you generated this you could use either the this ext. or the content-type-mapping extension to make it download (this one would let you name it correctly).

PDFs are tricker, since they are more than just XML/text.

oooh nice :) I’ll have a play.

cheers ashooner

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details