Hello,

I am trying to setup a csv file as data source. But I do not know how/
where I could dynamically change the file name of the csv file. In my
below example the name "email.csv" should actually be a file name
which can be set up in the controller.

the database.php contains:
    var $csv = array(
        'datasource' => 'Csv',
        'file' => 'email.csv'     <- this should be a variable file
name set up in the controller
    );

In my model I connect to the source like this:

    function csvFindAll() {
        $this->setDataSource('csv');
        $csv = $this->getDataSource();
        return $csv->findAll();
    }

the Csv_source.php file opens the file:

    function connect() {
        $this->File    = fopen(WWW_ROOT . 'files/' . $this-
>config['file'], "r");
        if (!$this->File) {
            return false;
        }else {
            return true;
        }
    }

Any ideas, hints how I could achieve that?

TIA,
Alex



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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