2
votes

I am beginner in cakePHP and woking on cakePHP 2.0. I am trying to generate CSV file, to accomplish this task i am using the following method.

cake php official site refr.

github refr.

i have got stucked in step no. 2 when it is loading the plugin. the following error is occurring in app/Config/bootstrap.php file

Fatal error: Class 'CakePlugin' not found in /var/www/html/sitefolder/app/config/bootstrap.php on line 51

CakePlugin::load('Export');

Please correct me. Thnaks

1
This is maybe due to bad Cakephp installation, Try to reinstall it and make sure you are using the latest version 2.x - YouneL
I'd recommend using CsvView for exporting to CSV in Cake. - drmonkeyninja
@drmonkeyninja not working. same error is displaying. - Ram Chander

1 Answers

2
votes

Thnaks guys for your precious response on this

For now i have find the solution of this by following steps.

  1. download the plugin files form https://github.com/joshuapaling/CakePHP-Export-CSV-Plugin

  2. by pass the step no.2 and step no.3 of what they have mentioned in official refer.

  3. copy the file "ExportComponent.php" from plugin and paste it in

    site_folder/app/controllers/components

  4. add it in controller's component array variable

    $components = array('blabla1', 'blabal2', 'Export')

  5. create $data array variable (which contains the csv file data ) and just do like

    $this->Export->exportCsv($data, 'filename1.csv');

Its done and working fine for me