Sure. Use an array, as suggested in the example on the include manual page,
but put all files in a specific directory in that array. To do that, use
code like the following:

# load files into array
# assign $directory to your variable, or replace $directory in the below
line with the directory you want.
$handle=opendir($directory);
while ($file = readdir($handle))  { # read all files in dir
 if  ($file != ".." && $file != ".") {
  $files_to_include[count($files_to_include)] = $file; # cram them files
into array ;)
};
};
#clean up and sort
closedir($handle);
if (is_array($files_to_include)) {
 while (list ($key, $val) = each ($files_to_include)) {
include $files[$i];
};
};

I modified some previous code to work for what you want, so my apologies if
there are missing curly braces or the like.

Hope this helps,
Erica


"andrew" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Is there any way to include whole directories?
> I have my function declarations in many small, easily maintainable
> files, but it's a pain to include/require them all individually...I
> would like to just split them into directories by common purpose, e.g
>
> functions/auth
> functions/content
> functions/modules
>
> and then include a directory at once - any ideas?
>
> cheers!
> andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to