It's a very simple thing, really. Something like this to give you an idea:

class CsvImporterComponent extends Object
{
        var $controller;
        var $uses = array ('Model');

        function startup(&$controller)
        {
                $this->controller =& $controller;
        }

        function import($csvFile)
        {
                // Do your thing and use $this->Model to save to your model
        }
}

Then on your controller you do:

var $components = array('CsvImporter');

and somewhere in there:

$this->CsvImporter->import('myfile.csv');

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-----Mensaje original-----
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Joe Crawford
Enviado el: Sábado, 17 de Febrero de 2007 06:32 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: Logical architecture for importing CSV or other files?

That sounds promising. I'll dive into the components documentation.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to