Welcome Guest, Not a member yet? Register   Sign In
CI and fpdf/fpdi
#1

[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
#2

[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
#3

[eluser]noviceCODER[/eluser]
thanks




Theme © iAndrew 2016 - Forum software by © MyBB