Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-23 23:08:09

DaveR
Member
From: Dunedin, New Zealand
Registered: 2004-04-20
Posts: 13

Download a dynamically generated file

Hi,

I want to allow users to download a text file containing the current contents of a mysql table. I’ve written a plugin to do all the backend stuff and it all works fine, except that textpattern adds the current page html and style css code to my data. If I set up a completely blank page and style the section returns a “section not found” error.

I feel I may be missing something obvious. How does one get textpattern to download a file thats generated on the fly?

Thanks,
Dave.

Offline

#2 2006-08-24 00:53:21

DaveR
Member
From: Dunedin, New Zealand
Registered: 2004-04-20
Posts: 13

Re: Download a dynamically generated file

Well, the moderator has moved me here, but this question is not about plugins.
I am asking in the most general sense how to get textpattern to download some arbitrary text as a file.
Where the text comes from is not the issue.

In php I can do this:

header(“Content-type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; filename=$myFileName”);
echo $myTestData;

This works but textpattern appends all its page and style code to the download. My question is how do I work around this? Hope that clarifies the issue.

Thanks,
Dave

Last edited by DaveR (2006-08-24 00:54:06)

Offline

Board footer

Powered by FluxBB