note 54430 added to function.include

From: Date: Mon, 04 Jul 2005 13:07:57 +0000
Subject: note 54430 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-91417@lists.php.net to get a copy of this message
When working with a well organized project you may come across multiple problems when including, if your files are properly stored in some nice folders structure such as: - src - web - bo - lib - test - whatever as the include path's behaviour is somehow strange. The workaround I use is having a file (ex: SiteCfg.class.php) where you set all the include paths for your project such as: $BASE_PATH = dirname(__FILE__); $DEPENDS_PATH = ".;".$BASE_PATH; $DEPENDS_PATH .= ";".$BASE_PATH."/lib"; $DEPENDS_PATH .= ";".$BASE_PATH."/test"; ini_set("include_path", ini_get("include_path").";".$DEPENDS_PATH); Make all paths in this file relative to IT'S path. Later on you can import any file within those folders from wherever with inlude/_once, require/_once without worrying about their path. Just cross fingers you have permissions to change the server's include path. ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54430 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54430&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54430&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91417) next »