PDA

View Full Version : write the file name?


BroChris
12-10-2002, 08:59 PM
How do I simply check the file's name and write it?

I don't want to just type the name of the file because I'm putting it in a different file which is included as the footer of every page.

Kiwi
12-10-2002, 10:25 PM
I'm not clear what you need. Somewhere the fuile name must be specified -- or else you can't tell php how to include it. Either it's a constant or a variable: php needs is a string for the filename.

Perhaps if you post your code and tell us how you know what file you're going to include it might help.

BroChris
12-10-2002, 10:51 PM
<?
$last_modified = filemtime("THE_CURRENT_FILES_NAME");
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?>

I'm going to have that within a page, which will be "included" into several other pages. I want the script to find out what page that it was included into so that it can see when it was last modified.

Maybe there's an easier way to do the last modified thing instead?

mordred
12-10-2002, 11:09 PM
<?
$last_modified = filemtime(basename($_SERVER['PHP_SELF']));
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?>

Alternatively, look at the server variables in your phpinfo(), there are a couple of variables that may or may not be available too for this kind of check.

BroChris
12-10-2002, 11:33 PM
that works great. thanks, mordred