• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Including and Requiring files.

Hi! I have a PHP library with many PHP files inside the same folder. There is one 'master' file that i have to include and this file can 'include' (depending on the function called) other files of the library. The problem with including in CI is the path. When using relative paths include doesn't work.

Do i have to change every 'include' path in the library?
There has to be some other way!!

Do you have your folders set up more or less like this?
+-- CI
  +-- application
    +-- controllers
    +-- models
    +-- views
  +-- system
+-- Your PHP library
Then you include your PHP library, but when your PHP library starts including its own files, it doesn't work because now the starting point for the relative path is CI, not the library.

Can you move your PHP library to your CI folder? On my system, at least, getcwd() returns "C:\Users\RobertSF\Apache\htdocs\ci"

Now that I think of it, that's going to put all the library files in your CI folder, but that's because the library designers put the 'master' file and all the other files at the same level.

Maybe someone else has a better idea. I'm still a noob. :red:

why not put your folder in the application/libraries and loading it by [b]foldername/filename[\b]. hope this helps.

You are right!

I have still not get used to CI's loading concept.
I use loding only for CI's libraries.
Thanks guys!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.