Re: Application.cfm like mechanism in PHP?

From: Date: Wed, 12 Dec 2001 02:31:50 +0000
Subject: Re: Application.cfm like mechanism in PHP?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77394@lists.php.net to get a copy of this message
Sure... sort of :) This is what I do... - in your webserver config file set auto_prepend.php to point to the following file: ----------------------------------------------------------------------- <?php # # This file is the first one read for every *.php request. It includes any # other "auto_prepend.php" file found in the path of the requested URL. # # # Loop through all the directories specified in the URL # and include any files named "auto_prepend.php. # $_dirs = split("/", $PHP_SELF); for( $_i=0; $_i < count($_dirs); $_i++ ) { $_dirPiece .= "/" . $_dirs[$_i]; if( $_dirPiece == "/" ) { $_dirPiece = ""; } $_file = $DOCUMENT_ROOT . $_dirPiece . "/auto_prepend.php"; if( @file_exists($_file) ) { include($_file); } } ?> ----------------------------------------------------------------------- Now if any directory contains a "auto_prepend.php" file it will be included automatically. Sure it's a little bit of overhead, but it sure makes life more convenient. -philip On Tue, 11 Dec 2001, christian calloway wrote: > Hey everyone, > > In coldfusion, if you have a file named Application.cfm in the same dir as > the script that is currently executing, then the coldfusion server will > automatically include that file in beginning of every script in that > directory. Is there any way, by manipulating the php config settings, to > accomplish the automatic inclusion of code libs? Thanks, > > Christian > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#77394) next »