Welcome Guest, Not a member yet? Register   Sign In
Using PHP classes in Codeigniter
#1

[eluser]Unknown[/eluser]
Hi there,

I have coded a system using PHP without a framework and am now redeveloping it using Codeigniter.

Originally, I had a class that helps you create a PDF. All you have to do is include the file, and then extend the class to create your PDF. You can then invoke your new class to create the PDF.

I tried to use this within a controller in Codeigniter and it didn't like my require() statement that I was using to include the 3rd party library. It said the file or directory did not exist.

So my question is, can I use this library in Codeigniter?

I thought maybe I had to create a library and put it in the libraries folder, but it didn't even like the require statement that I used in there.

Any help would be greatly appreciated! Thanks!
#2

[eluser]TaylorOtwell[/eluser]
You should be able to use it. Can you post the require statement you are using in your controller and where the class file is located?
#3

[eluser]Unknown[/eluser]
My apologies for posting too eagerly! Hopefully someone else will find this useful though.

I was simply using require('/path/to/file.php'). I moved the file into my libraries folder and used: require(APPPATH."libraries/pdf/fpdf.php"); and it all works fine now.

Thanks for taking the time to read and reply!




Theme © iAndrew 2016 - Forum software by © MyBB