Page 1 of 1

How to See if File Exists

Posted: Fri Aug 20, 2004 8:43 am
by NewfieBilko
Hey guys, simple request for code here. Just need logic that will check to see if a file is in a directory.

So something like

If "./include/thisfile.php exists = true"
then{
load this}
Else{
Load this}
EndIf

lol im sorry, i just love pseudo code

Posted: Fri Aug 20, 2004 8:45 am
by hawleyjr
[php_man]is_file[/php_man]

Posted: Fri Aug 20, 2004 8:50 am
by NewfieBilko
thx bro

Posted: Fri Aug 20, 2004 8:56 am
by NewfieBilko
Hey bro, you know a way that you can:

Include AllFiles In A Specific Directory?

instead of going
include_once("./lang/$lang/error.php");
include_once("./lang/$lang/another.php");
include_once("./lang/$lang/anoteher.php");



I just wanna go

Loop While Not -1 /$langdir/
{
include_once(file1)
}




lol

Posted: Fri Aug 20, 2004 8:58 am
by hawleyjr
Loop through all of the files in the directory and insert each in an include. Be sure to check for '.' and '..' All the code to do this is in this forum.

Posted: Fri Aug 20, 2004 9:03 am
by NewfieBilko
How can I pick up what files are in the directory? is_file doesn't do that, is_file checks to see if the designated file is there. How can i get a dirtectory list?

Posted: Fri Aug 20, 2004 9:13 am
by hawleyjr