Ergh, no. That's not really what I was looking for. By the way, this sort of for "marking" purposes.
I may have to rephrase what I meant -- I'm trying to check the directory. Let's say I have some files under the directory
/path/to/. Then, let's say I have a function that displays a message of which page is currently "active."
/path/to/- /path/to/one.php
- /path/to/two.php
- /path/to/three.php
- /path/to/four.php
- /path/to/five.php
Instead of checking to see if each file exists under that directory:
CODE
<?php
$uri = $_SERVER['SCRIPT_NAME'];
$file = array(
'one' => '/path/to/one.php',
'two' => '/path/to/two.php',
'three' => '/path/to/three.php',
'four' => '/path/to/four.php',
'five' => '/path/to/five.php'
);
if ($uri == $file['one']) echo 'Page is active.';
else if ($uri == $file['two']) echo 'Page is active.';
else if ($uri == $file['three']) echo 'Page is active.';
else if ($uri == $file['four']) echo 'Page is active.';
else if ($uri == $file['five']) echo 'Page is active.';
else echo 'No page is active.';
?>
It'd be more efficient, I would think, to just use something along the lines of a "wildcard" (my proposed concept) to check if there is an active file that is under that certain directory, no matter the file name, as long as the file is active and under that directory :
CODE
<?php
$uri = $_SERVER['SCRIPT_NAME'];
$all = *WILDCARD METHOD HERE*; // My "wildcard" variable that would have all the file names under a directory.
if ($uri == '/path/to/' . $all . '.php') echo 'Page is active.';
else echo 'No page is active.';
?>
Then, I'd be able to use that method in a function of some sort to use in a header file as opposed to individually marking each file with that text whereas PHP could just do it for me.
Oh, and while writing this, I got the idea that I had to figure out how to get all the file names under the directory and store them somehow into a variable or something where the
variable would represent the
wildcard, in this case.