![]() |
Using PHP classes in Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Using PHP classes in Codeigniter (/showthread.php?tid=36351) |
Using PHP classes in Codeigniter - El Forum - 11-29-2010 [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! Using PHP classes in Codeigniter - El Forum - 11-29-2010 [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? Using PHP classes in Codeigniter - El Forum - 11-29-2010 [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! |