|
Posted by R. Rajesh Jeba Anbiah on 09/09/05 13:03
tom pester wrote:
> Hi,
>
> Im new to php and have a background in asp. All the help is very much appreciated.
>
> today I was using the include function in a file that itself gets included :
>
> ***************
> consumer.php : <? include "inc.php" ?>
>
> inc.php : <? include "Common/functions.php" ?>
^^^^^^^^^
Don't use include path like this. Better use relative path (eg,
../foo ../foo) or absolute path (eg, /foo). Usage of this will result in
ambiguous directory resolve (ie, it will start searching the existence
of path in include_path, etc) and will hit performance.
FWIW, I use something like:
<?php
//config.inc.php
$CFG['project_path'] = '/home/foo/foo/';
//etc etc
?>
<?php
//foo.php
require_once('../common/config.inc.php'); //relative to project
require_once($CFG['project_path'] . 'html/header.html'); //absolute
//etc etc...
require_once($CFG['project_path'] . 'html/footer.html'); //absolute
?>
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Navigation:
[Reply to this message]
|