Welcome Guest, Not a member yet? Register   Sign In
how to install phpjasperxml in codeigniter
#1

[eluser]Unknown[/eluser]
hi...

i've phpjasperxml class (http://www.simit.com.my/?q=phpjasperxml) this class is convert xml(created by ireport) to fpdf.
i'm new in codeigniter,i dont know how to insert this class in codeigniter...
need help please..

..sorry for my bad english ^_^...

thx
#2

[eluser]pistolPete[/eluser]
Have a look at user_guide/general/creating_libraries.html.

Copy PHPJasperXML.inc to application/libraries.
Rename the file to PHPJasperXML.php.
Copy the folder fpdf to application/libraries.
Insert the following line to PHPJasperXML.php after the <?php tag:
Code:
include_once('./fpdf/FPDF.php');

You should now be able to load the library in your controller using
Code:
$this->load->library('PHPJasperXML');
...
$this->phpjasperxml->xml_dismantle($xml);
$this->phpjasperxml->outpage("I");
#3

[eluser]Unknown[/eluser]
thanks it work..
#4

[eluser]sramos[/eluser]
Im also using the PHPJasperXML0.7a, but ive noticed that when generating the report i get lots of notices. I put the @ before the PHPJasperXML class calls and it works fine. I dont think its totally sweet to silence the errors, so anybody had corrected the PHPJasperXML class?? It has a lot of details that generates the notices.


This is my not honey moon solution:

Code:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//include_once('class/fpdf/fpdf.php');
//include_once("class/PHPJasperXML.inc");
//include_once ('setting.php');

$this->load->library('PHPJasperXML_etc/PHPJasperXML');

$xml =  simplexml_load_file($jasperfile);


@$PHPJasperXML = new PHPJasperXML();
@$PHPJasperXML->debugsql=false;
@$PHPJasperXML->arrayParameter=$arrayParameters;
@$PHPJasperXML->xml_dismantle($xml);

@$PHPJasperXML->transferDBtoArray($server,$user,$pass,$db);
@$PHPJasperXML->outpage("I");    //page output method I:standard output  D:Download file


?>
#5

[eluser]danmontgomery[/eluser]
@ is a very resource-intensive solution. Errors can and should be silenced in a production environment.
#6

[eluser]sramos[/eluser]
[quote author="noctrum" date="1278456476"]@ is a very resource-intensive solution. Errors can and should be silenced in a production environment.[/quote]

Thanks!, I normally like to pray and use a try-catch block for errors. I log them and propagate depending on the application layer the error occurs.

Even for the fatal errors i like to use the strategy described on this post:
http://ellislab.com/forums/viewthread/97198/#492446
what i do is also to log them, and put a not bleeding output.

Ive seen that when you use @ you do a total silence, and i want to still log for errors.
#7

[eluser]dunialebah[/eluser]
$xml = simplexml_load_file("report/chathuReport.jasper");

I have error from that, this is the error

Message: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "report/chathuReport.jasper"

What I have to do?
#8

[eluser]CroNiX[/eluser]
give it a full path to the file.
#9

[eluser]dunialebah[/eluser]
thanks CroNix, but I get this error

Message: simplexml_load_file() [function.simplexml-load-file]: report/report1.jasper:1: parser error : Start tag expected, '<' not found
#10

[eluser]dunialebah[/eluser]
Code:
$this->load->library('PHPJasperXML');
  

  $path = site_url('report/report1.jrxml');
  //echo $path;
  //echo htmlspecialchars($path);
  
  $xml =  simplexml_load_file($path);
  
  //var_dump($xml);
  
  $PHPJasperXML = new PHPJasperXML();
  $PHPJasperXML->debugsql=true;
  $PHPJasperXML->arrayParameter=array("parameter1"=>"this isi a parameter");
  $PHPJasperXML->xml_dismantle($xml);
  
  
  
  //$PHPJasperXML->transferDBtoArray('localhost','root','','cms8');
  $PHPJasperXML->outpage("D");    //page output method I:standard output  D:Download file

That's my code but I got small blank pdf file without file name




Theme © iAndrew 2016 - Forum software by © MyBB