Integrate Jasperclient jrs-rest-php-client in Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Integrate Jasperclient jrs-rest-php-client in Codeigniter (/showthread.php?tid=1202) |
Integrate Jasperclient jrs-rest-php-client in Codeigniter - mgiesl2s - 02-18-2015 How can i integrate the PHP Jasperclient jrs-rest-php-client from github (https://github.com/Jaspersoft/jrs-rest-php-client) in Codeigniter? With this Code I can use the Jasper PHP-Client without codeigniter in the root folder (I have replaced some code lines with XXX): require_once "autoload.dist.php"; use Jaspersoft\Client\Client; $c = new Client (XXX) $controls = array (XXX); $report = $sc->reportService()->runReport('XXX', 'pdf', null, null, $controls); XXX(some html stuff) echo $report; Now, to use it as helper in codeigniter I have already copied the jrs-rest-php-client and created a helper (jasperclient_helper) class in application\helpers. The Helper Class have the following code: <?php function jasperclient(){ require_once 'jrs-rest-php-client-master/autoload.dist.php'; use Jaspersoft\Client\Client; } my Controller Class have the following code: Class jasperreport extends CI_Controller { function pdf() { $this->load->helper('jasperclient_helper'); $c = new Client(XXX); $controls = array(XXX); $report = $sc->reportService()->runReport('XXX', 'pdf', null, null, $controls); $data["report"] = $report; $this->load->view('jasperreport_view', $data); } } ?> When I want to use it as helper i get a parse error: syntax error unexpected 'use' (T_USE) in C:\...\application\helpers\jasperclient_helper.php on line 10 line 10 have the following code: "use Jaspersoft\Client\Client;" Can somebody help me? RE: Integrate Jasperclient jrs-rest-php-client in Codeigniter - mwhitney - 02-19-2015 You can't use the "use" keyword inside a function. |