Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Creating a downloadable file from a Smarty template

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Stephanie
Smarty n00b


Joined: 12 Dec 2005
Posts: 4

PostPosted: Mon Nov 21, 2011 8:30 pm    Post subject: Creating a downloadable file from a Smarty template Reply with quote

I want to be able to create a download file of my Smarty output. Specifically, I have a template that creates XML. I want to be able to have that download directly to the user's computer as a .xml file.

Any ideas?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7270
Location: Lincoln Nebraska, USA

PostPosted: Mon Nov 21, 2011 8:46 pm    Post subject: Reply with quote

maybe this:

Code:
header('Content-disposition: attachment; filename="foo.xml"');
header('Content-type: "text/xml"; charset="utf8"');
$smarty->display('foo.tpl');
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP