koolreport icon indicating copy to clipboard operation
koolreport copied to clipboard

How to use KoolReport in CakePHP

Open jholthusen opened this issue 8 years ago • 1 comments

I am trying to integrate koolreport into Cake PHP 3 . COuld you please share a short tutorial on the correct approach and how to distribute the different components between Controller and View in Cake? Thanks!

jholthusen avatar Oct 30 '17 20:10 jholthusen

Hi,

The same with other MVC frameworks, The way to setup KoolReport is simple.

  1. Save the "koolreport" folder into "vendors" folder of Cake
  2. In the "app" folder, you can create a folder name "reports" to hold all reports created with KoolReport
  3. Create a SaleReport.php and SaleReport.view.php inside "reports" folder.
  4. In SaleReport.php, please require correct path to "koolreport/autoload.php"
  5. On top of your controller, for example PageController.php, you put require with correct path to SaleReport.php for example require "../reports/SaleReport.php"
  6. Inside the controller action, you can start create report object:
$report = new SaleReport;
$report->run();
$this->set("report",$report);
  1. In the view of the controller, you can render the report:
<div>
<?php $report->render(); ?>
</div>

Hope that helps.

koolphp avatar Oct 31 '17 12:10 koolphp