Register FAQ Search Today's Posts Mark Forums Read
Miva Merchant Community Forums
User Name
Password
Claudiu
  #1  
Old Posted: 04-02-09, 07:58 PM
Mivite
Claudiu's Avatar
Joined Mar 2006
Posts: 111 Claudiu is on a distinguished road
Miva output header
Hi everyone,

I had to make a script lately that made me use the miva_output_header function. I wanted to share a small function that can be handy when someone wants to share files ( put files on download ) without making links.

I wrote an article here: http://mivascript.org/miva_script_fr...ad_script.html . Any comments welcomed...

PS: I promise i won't write a post for every function I share in the future but this one can be tricky...

Thank you
Claudiu

Miva Script - www.mivascript.org - only for MivaScript developers (new website in construction)
Zen Radio : Relax yourself: www.zenradio.fm
Send a message via MSN to Claudiu  
Reply With Quote
Kent Multer
  #2  
Old Posted: 04-03-09, 12:56 AM
Mega Mivite
Kent Multer's Avatar
Joined Mar 2006
Posts: 1,021 Kent Multer is on a distinguished road
Re: Miva output header
Hey Claudiu, are you reading my mind? I've been thinking about exactly this subject recently; I need this download capability for a project I'm working on. You just saved me some hours of reading, experimenting, and head-scratching.

I miss Ivo's contributions around here, but you're a good substitute . Thanks --

Kent Multer
Magic Metal Productions
http://TheMagicM.com
* Web developer/designer
* E-commerce and Miva
* Author, The Official Miva Web Scripting Book -- available on-line:
http://www.amazon.com/exec/obidos/IS...icmetalproducA
 
Reply With Quote
Claudiu
  #3  
Old Posted: 04-03-09, 04:35 AM
Mivite
Claudiu's Avatar
Joined Mar 2006
Posts: 111 Claudiu is on a distinguished road
Re: Miva output header
Hi Kent

So glad it helps ! That's the big idea with the shared code You have no idea how much your book helped (and still helps) me... so I should thank you first

Thanks
Claudiu

Miva Script - www.mivascript.org - only for MivaScript developers (new website in construction)
Zen Radio : Relax yourself: www.zenradio.fm
Send a message via MSN to Claudiu  
Reply With Quote
Claudiu
  #4  
Old Posted: 04-06-09, 09:11 AM
Mivite
Claudiu's Avatar
Joined Mar 2006
Posts: 111 Claudiu is on a distinguished road
Creating Excel files with Miva Script
While trying to find a way to create excel files on the fly, I found a dirty and ugly solution, that you can find here: http://mivascript.org/miva_script_create_excel.html

It's dirty, as we play with the header, and excel will see that the content of the file is not excel. But I'll try to find a solution for that matter too ...

Anyway, it's a good solution if you want to give the possibility to export excel file on Linux server, using Miva Script

Any comments welcomed !

Miva Script - www.mivascript.org - only for MivaScript developers (new website in construction)
Zen Radio : Relax yourself: www.zenradio.fm
Last edited by Claudiu; 04-06-09 at 09:14 AM..
Send a message via MSN to Claudiu  
Reply With Quote
RayYates
  #5  
Old Posted: 04-09-09, 01:44 PM
Developer Partner
RayYates's Avatar
Joined Dec 2006
Posts: 737 RayYates is on a distinguished road
Re: Miva output header
I've done something very similar for streaming live .csv and txt reports out as a download.

As for excel, I've output a .csv file this way.

<MvASSIGN NAME = "l.null" VALUE = "{ miva_output_header('Content-type', 'application/vnd.ms-excel') }">

Excel is offered as the default program during the download dialog box, and opens the file just fine.

A note about .csv files; you need to make sure any data that contains commas gets wrapped in double quotes.

Ray Yates
"If I have seen further, it is by standing on the shoulders of giants."
--- Sir Isaac Newton
PCI Net: http://www.pcinet-llc.com/
PCI Net Toolbelt: http://www.mivacentral.com/Merchant2...&partnerpage=1
PCI Net Toolbelt Documentation: http://www.pcinet-llc.com/docs/toolbelt_docs.shtml
 
Reply With Quote
brian_77
  #6  
Old Posted: 05-27-10, 05:40 PM
Mivite
Joined Nov 2008
Posts: 156 brian_77 is on a distinguished road
Re: Miva output header
Hi Claudiu,

On this page http://mivascript.org/miva_script_fr...ad_script.html

there is code for force download not for create xls file.

>>THE CODE

You can see the code here: http://mivascript.org/share/scripts/...ownload.mv.txt

 
Reply With Quote
Claudiu
  #7  
Old Posted: 05-27-10, 09:49 PM
Mivite
Claudiu's Avatar
Joined Mar 2006
Posts: 111 Claudiu is on a distinguished road
Re: Miva output header
Hi Brian

Yes, indeed, the page is talking about forced download. The excel one is here: http://mivascript.org/miva_script_create_excel.html . I used the same link for the forum apparently

PS: Thanks Ray for your suggestion !

Best regards,
Claudiu

Miva Script - www.mivascript.org - only for MivaScript developers (new website in construction)
Zen Radio : Relax yourself: www.zenradio.fm
Send a message via MSN to Claudiu  
Reply With Quote
BPS
  #8  
Old Posted: 05-28-10, 11:36 AM
Mini Mivite
Joined Aug 2009
Posts: 24 BPS is on a distinguished road
Re: Miva output header
Hi,


I visited this link http://mivascript.org/miva_script_create_excel.html

but i only get code for the function force download.did not get function for create xls file.
Send a message via Skype™ to BPS  
Reply With Quote
RayYates
  #9  
Old Posted: 05-28-10, 02:14 PM
Developer Partner
RayYates's Avatar
Joined Dec 2006
Posts: 737 RayYates is on a distinguished road
Re: Miva output header
The example is creating the data and outputing the file at the same time, so no physical file is ever created.

By setting the headers you get the browser 'file download" dialog box and the contents are streamed to your hard disk instead of to the browser screen.

Using Toolbelt, you can even do this in a Storemorph page template. Use Query to get the data, then format it as a simple tab separated text file.

I've created custom data export screens for several clients this way.

Ray Yates
"If I have seen further, it is by standing on the shoulders of giants."
--- Sir Isaac Newton
PCI Net: http://www.pcinet-llc.com/
PCI Net Toolbelt: http://www.mivacentral.com/Merchant2...&partnerpage=1
PCI Net Toolbelt Documentation: http://www.pcinet-llc.com/docs/toolbelt_docs.shtml
Last edited by RayYates; 05-28-10 at 02:19 PM..
 
Reply With Quote
Claudiu
  #10  
Old Posted: 05-29-10, 01:35 AM
Mivite
Claudiu's Avatar
Joined Mar 2006
Posts: 111 Claudiu is on a distinguished road
Re: Miva output header
Hi again,

Indeed, this way you cannot save the file, you can only stream it to the browser (and it's a very "amateur" approach with lots of inconvenient). I'll make the function to save the binary excel file this week and I'll post it here. I'll try to do it in mivascript (oh yes, it's possible) or in a C++ library (it's easier).

PS: I updated the excel page... You were right, I messed up the links and there was an example of the forced download, not the one with the excel file...

Cheers,
Claudiu

Miva Script - www.mivascript.org - only for MivaScript developers (new website in construction)
Zen Radio : Relax yourself: www.zenradio.fm
Send a message via MSN to Claudiu  
Reply With Quote
Reply Reply to Thread

Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 02:07 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.