> function group_include($directory)
> {
> $handle=opendir("$directory");
> while ($file = readdir($handle))
> { //load files in $directory into array
> if ($file != ".." && $file != ".")
> {
> $files_to_include[count($files_to_include)] = $file;
The count(...) is pretty silly here. Get rid of it. PHP will do what you
want.
> }
> }
>
> //clean up and sort
> closedir($handle);
> if (is_array($files_to_include))
> {
> while (list ($key, $val) = each ($files_to_include))
> {
> include "$directory/$val";
> }
> }
> }
Why create an array and then walk through it? Why not just include() as you
go?...
Also, this is pretty dangerous... A hacker only needs to manage to upload
one file to your web-directory, and they've taken over your machine.
Don't do this.
> //include common and page specific modules
>
> $common_include_dir="modules/common";
> $page_include_dir="modules/page";
>
> group_include($common_include_dir);
> group_include($page_include_dir);
>
The list of files simply can't be that large.
Why not just have a file in modules/common that includes all the other files
in modules/common, and then edit that as you add files to modules/common,
and then you can just include that one file.
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
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]