O'Reilly logo

CakePHP 1.3 Application Development Cookbook by Mariano Iglesias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parsing CSV files with a datasource

This recipe shows how to parse comma-separated values (CSV) files using a datasource, showing a clean approach to CSV processing.

Getting ready

We start by installing CakePHP's datasources plugin. Download the latest release from http://github.com/mariano/datasources/downloads and uncompress the downloaded file into your app/plugins folder. You should now have a directory named datasources inside app/plugins.

The datasources plugin, located at http://github.com/cakephp/datasources, is an official CakePHP plugin that offers several community-provided datasources, such as XML-RPC and SOAP. This and other recipes use a customized version of the plugin, modified for the purpose of this book.

We need some sample data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required