• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need to include a file outside of the codeigniter directory

I have a file from a form that I need to include. It will gather the users information (if they are logged in, etc). It returns and sets a bunch of stuff and I don't want to have to put it into CI. It's meant to be included outside of the form for that purpose.

How do I call that file? I've tried something like this:


but that didn't work (even tried full path to file but it errors out saying: 'URL file-access is disabled in server configuration' ...not sure what to change). Any ideas?

Never mind, i mis-read your post...

In the actual php language, there are two ways to include other php files. There may be a CI solution, and if so, I'm sure somebody else will chime in.

#1: include '/home/~learn/php/and/you/would/not/need/to/ask/this/question.php';

#2: require '/home/~learn/php/and/you/would/not/need/to/ask/this/question.php';

You can also use _once on the end, and this makes it so that the include can only be loaded once.

include_once ''; or require_once '';

"require" is used when you want to load something, and if it fails to load the script will die. Using "include" will allow the script to keep running if it fails to load the included file.

The php manual is at php.net, and if you haven't read it, you really should. It's very awesome.

Ya...when I used those, that's when it gives me the error as well. So perhaps it's not a CI issue? I'm running MAMP locally but I've got the php.ini configured to allow it. Not sure what's up.

Got it to work. Used the following:


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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