News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

MaltBlue.com:
Basic CSV Output in Zend Framework 2
July 18, 2013 @ 09:20:42

Matthew Setter has a new post on the MaltBlue site about creating CVS output from a Zend Framework 2 based application. Instead of writing to a CSV file on the local file system, he opts to push the information out to the user directly in the browser.

Today's tutorial is a simple one. We're going to look at a simple way of rendering CSV output in Zend Framework 2 using a combination of a View Template and Controller Action. We're going to see just how easy it is to generate content and send it to the browser, instead of rendering a standard .pthml template.

He includes the module configuration that sets up the location of the CSV template file and defines the "download/download-csv" header. The view template is pretty simple - just a loop of the results that calls fputcsv to push the data info a file handle. The code for the controller is also included, showing how to create a view model to push the data out.

0 comments voice your opinion now!
cvs output zendframework2 tutorial viewmodel

Link: http://www.maltblue.com/tutorial/simple-csv-output-in-zend-framework-2

blog comments powered by Disqus

Similar Posts

MaltBlue.com: Zend Framework 2 Modules - The Application's Heart

PHPBuilder.com: Using SPL Iterators in PHP to Interact with Different Data Types

Sankho Mallik's Blog: Tutorial: Using Zend_Captcha_Image

Sudheer Satyanarayana's Blog: XML RPC Client Using PHP PEAR - A Real World Example: Ping Technorati

DevShed: An Introduction to Sockets in PHP (Part 1)


Community Events





Don't see your event here?
Let us know!


interview library application community bugfix release project laravel wordpress developer threedevsandamaybe list code configure framework podcast introduction api language series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework