• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrate Jasperclient jrs-rest-php-client in Codeigniter

#1
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?
Reply

#2
You can't use the "use" keyword inside a function.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.