Welcome Guest, Not a member yet? Register   Sign In
Loading a library (works fine in native php)
#1

[eluser]deco10[/eluser]
I need to use a library (class) on my CI site. I use this class on other sites with no issues.

I renamed the files so they matched the name of the class in the file which gets CI to (try) and load them. It gives me a load of errors though (in this case an undefined index in the class)

Hopefully somebody can help me with this. If you have questions or need more info please ask Smile

Code:
$this->load->library("Cpdf");        
        $this->load->library("Cezpdf");        

        $pdf =& new Cezpdf();
        $pdf->selectFont('./fonts/Courier.afm');
#2

[eluser]jedd[/eluser]
[quote author="deco10" date="1260936314"]
I renamed the files so they matched the name of the class in the file which gets CI to (try) and load them. It gives me a load of errors though (in this case an undefined index in the class)
[/quote]

Show, rather than tell. Specifically, file name and location - and class declaration (inside the library) - and error message (verbatim).

The error - does it give a line number? Is it the load-> or the & new line in the controller, or an error within the library file?
#3

[eluser]deco10[/eluser]
Its an error within the library (index undefined)

system/application/libraries/Cezpdf.php
system/application/libraries/Cpdf.php

Code:
<?php

//This is the Cezpdf.php file
//Not sure how I should go about letting this include there.
include_once('Cpdf.php');

class Cezpdf extends Cpdf {




//This is the Cpdf.php file
<?php

class Cpdf {


the error (occurs several times):

A PHP Error was encountered

Severity: Notice

Message: Undefined index:

Filename: libraries/Cpdf.php

Line Number: 1631
#4

[eluser]deco10[/eluser]
This was the problem:

$pdf->selectFont('./fonts/Courier.afm')

changed it to

$pdf->selectFont('system/application/libraries/fonts/Courier.afm')




Theme © iAndrew 2016 - Forum software by © MyBB