We just pushed a new, very simple free plugin to our GitHub account. Download Content is handy if you are using channels to manage information that you want to have available as file downloads for your visitors. It’s essentially a very simple way to utilize CodeIgniter’s download helper within an ExpressionEngine template. It takes arbitrary content, and sends it to the browser with the proper file type headers for download.
For example, we’re using it on our intranet to have… Continue reading…
I may well be doing something dumb, but I have not been able to get the plugin to work - i get an ‘invalid tag (no such plugin..)’ warning in the template. I have tried placing the pi.download_content.php file in the system/expressionengine/plugins folder, and also placing the download-content folder, containing the php file, in the system/expressionengine/third_party folder - neither works and the plugin does not show up in my plugins list in the CP in either case.
I am on EE 2.1.3 - is that the problem? I would be grateful for some advice. Thanks.
Changing the folder name has worked, but only so far as the plugin is now appearing correctly in the plugins list in the CP. I am still getting this error when I try to view a template:
Error
The following tag has a syntax error:
{exp:content_download}
Please correct the syntax in your template
The tag is on a blank template, for testing purposes, with just the following code:
I felt v stupid until I remembered that I had copied and pasted the original code from the github php file - I went to check, and sure enough the ‘content_download’ sample code is right there, and of course, as a result, it appears like that on the CP in the plugin section.
I normally think that EllisLab are geniuses at everything, but on this occasion I think they might have let a couple of things slip by - first, the folder name for this plugin and second the sample code. I should have spotted that, of course - but at least someone out there in the EE community has sharp eyes. I guess someone should fix that.
Many thanks indeed - it now seems to be working as intended and will be useful - and I still love EllisLab, by the way.
It would essentially be limited to file types that you can “hand roll” since you are building the file itself in your template with your template code and channel content.
So I imagine just flat files and no compressed zip/rar if we pull multiple entries from channels?
Could we put together a list of file ext?
html,htm,xml,css,txt…???
Well, even that would be possible, if you combined with another plugin - one that took the content and zipped it, for instance, though I’d think that such a plugin would probably also include the download mechanism, removing the need for two separate plugin tags. This plugin is really very simple - any content between the tag pairs is sent to the browser as a download. How you build that content and what format it is in is entirely up to you.
It would be very difficult even to list every file extension that you could hand roll without any extra processing, as there are so many. vcf, ics, csv, and so on.
Changing the folder name has worked, but only so far as the plugin is now appearing correctly in the plugins list in the CP. I am still getting this error when I try to view a template:
How can I get this to format correct when trying to export channel entries to a CSV? I have tried this code but it is breaking up results incorrectly in cells when I open in Excel. Just trying to export two fields with this test. simple_content_body is a long string with about 300 characters.
OK a short string works fine it seems, but when a longer string is used it causes the lines to break up. Why would this string not work? Is there a character limit or something or is the paragraph tag the issue?
<p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
Can you share your new EE code that you’re using? Your first example doesn’t output CSV formatted content, just two fields with a line break in-between them.