Hi,
Thank you for your reply. Whatever you have stated is a repeat of instructions given in the Codeigniter Package. Then you advice "Here are step-by-step tutorial of integrating KoolReport to CodeIgniter without codeigniter package." How does this help?
This is what i did:
(1) Installed Codeigniter
(2) Unzipped Koolreport and Examples
(3) Imported database "automaker"
(4) Configured CI for the database
(5) Copied the Koolreport folder into CI's Application->libraries folder
(6) Copied the Codeigniter folder into CI's Application->libraries folder
(7) I executed all the steps mentioned in your first reply to Tee in "integrating KoolReport to CodeIgniter without codeigniter package" page.
(8) Created the MyReport.php and MyReport.view.php in the assets folder as stated
(9)Then in the MyReport.php i included the line "use \koolreport\codeigniter\Friendship;"
(11) Execute my application.
This is what i did before and now. After some initial folder problems, I get this:
The code in assets-> MyReport.view.php:
<?php
//MyReport.view.php
use \koolreport\widgets\koolphp\Table;
?>
<html>
<head>
<title>MyReport</title>
</title>
</head>
<body>
<h1>MyReport</h1>
<h3>List all offices</h3>
<?php
Table::create(array(
"dataStore" => $this->dataStore("offices"),
"class" => array(
"table" => "table table-hover",
),
));
?>
</body>
</html>
Code in assets->MyReport.php:
<?php
//MyReport.php
require APPPATH . "/libraries/koolreport/core/autoload.php";
class MyReport extends \koolreport\KoolReport
{
use \koolreport\clients\Bootstrap;
use \codeigniter\Friendship;
public function settings()
{
return array(
"assets" => array(
"path" => "../../assets",
"url" => "assets",
),
"dataSources" => array(
"automaker" => array(
"connectionString" => "mysql:host=localhost;dbname=automaker",
"username" => "root",
"password" => "",
"charset" => "utf8",
),
),
);
}
public function setup()
{
$this->src('automaker')
->query("Select * from offices")
->pipe($this->dataStore("offices"));
}
}
Code in controller->Welcome.php
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . "../assets/MyReport.php";
class Welcome extends CI_Controller
{
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
public function runreport()
{
$report = new MyReport;
$report->run()->render();
}
}
Directory Structure of CI: