RE:[PHP] file knowing its own directory

From: Date: Sun, 13 Jun 2004 20:42:45 +0000
Subject: RE:[PHP] file knowing its own directory
Groups: php.general 
Request: Send a blank email to php-general+get-188192@lists.php.net to get a copy of this message
Just for the record, (and archives), This can be accomplished by: dirname( __FILE__); This allowes me to put the following into an application's config file, to be included via the prepend, the following localized, global values: (assuming the application's files are kept OUT of the document root for security's sake) $APPLICAITON_NAME_VALUES["MAIN_DIR"]= dirname(__FILE__)."/"; //on linux anyway. $APPLICAITON_NAME_VALUES["NEEDED_VALUE_1"]= 'VALUE_1"; $APPLICAITON_NAME_VALUES["NEEDED_VALUE_2"]= 'VALUE_2"; blah blah causing VERY little global name pollution. gearond@fireserve.net wrote:
please CC me 'cause I am on digest the scenario: three files:
      .htaccess
         has line saying "php_prepend 'true_filesystem_location_php_prepend_file' "
      prepend.php (aforementioned prepend file)
         has line saying "include file_a.php"
      file_a.php
         has line saying"$my_true_file_system_location = I_NEED_A_FUNCTION_HERE;"
So, what do I replace I_NEED_A_FUNCTION_HERE with?


« previous php.general (#188192) next »