CodeIgniter Forums

Full Version: CI and fpdf/fpdi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]pendalpusher[/eluser]
Yesterday I got Fpdf and Fpdi working within the CI framework.

Currently to access the classes I am doing this.

Code:
$this->load->library('fpdf');
$this->load->library('fpdi');

//now do something with them
$this->fpdi->AddPage();
$this->fpdi->Output();

My question is how to make multiple instances? Outside of CI i would do it like this

Code:
$pdf1 = new fpdi();


$pdf2 = new fpdi();

Do I need make two seperate models? or what?

Thanks in advance.

P

El Forum

[eluser]rogierb[/eluser]
The third parameter in load in loading a library is used to assign the class to a different name.

It's in the userguide:
Quote:Assigning a Library to a different object name

If the third (optional) parameter is blank, the library will usually be assigned to an object with the same name as the library. For example, if the library is named Session, it will be assigned to a variable named $this->session.

If you prefer to set your own class names you can pass its value to the third parameter

El Forum

[eluser]noviceCODER[/eluser]
thanks