faqts : Computers : Programming : Languages : PHP : kms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 7 people (100%) answered Yes
Recently 7 of 7 people (100%) answered Yes

Entry

Going with an include one directory deeper and one higher?

Feb 25th, 2002 16:07
Philip Olson, bhavin panchal, Christian Mehler,


Doing relative includes is possible but it's important to have a . in
your include_path directive, which is found in php.ini  More information
on include_path is in the PHP manual, here:
  http://www.php.net/manual/en/configuration.php#ini.include-path
Note that " . is for the current directory" so if you have that defined
in your include_path then you can include relative to the current
directory.  So, let's assume the following directory structure and files
exist:
  /var/www/cows/spots.inc
  /var/www/cows/big/show.php
  /var/www/cows/big/includes/moo.inc
In show.php we might have:
  include '../spots.inc';
  include './includes/moo.inc';
Sure that's a silly example but hopefully demonstrates a point :)