directory timestamps - limiting by date

From: Date: Tue, 06 Aug 2002 02:35:44 +0000
Subject: directory timestamps - limiting by date
Groups: php.general 
Request: Send a blank email to php-general+get-111316@lists.php.net to get a copy of this message
hiya - i've been thinking about this problem for over a week now & haven't come up with anything solid. thought i'd see if anyone more knowledgeable than i could share suggestions. i inherited a website written in php, using mysql, running on iis5 (ick). one of the pages of the site lists the various departments in the site. the directory structure looks something like this: departments (directory) -- department 1 (subdirectory) -- department 2 (subdirectory) -- department 3 (subdirectory) when someone goes to www.whatever.com/departments/ , they are presented with a simple page containing links to each of the departmental subdirectories. the index page in departments directory is written in php, as it includes a few other files for navigation / etc, however, the links to the subdirectories are hard-coded on the page - just href's to each subdirectory. what i'd like to do is to be able to add a little blurb to the departments/index.php page indicating that a particular department web page was updated within say the past 30 days. for instance if department 1 updated their page yesterday, beside their link it would say (Updated August 03, 2002). after 30 days, assuming they hadn't done any more updating, the little 'Updated' blurb would disappear. if a department hadn't updated anything in 30 days, nothing would appear beside their link. i assume that in order to do this, i would need to write a script that basically says "look at the timestamp on the directory. if the timestamp is less than 30 days old, include xyz on the index page. if it is older than 30 days, include nothing" so... any ideas as to how this would be implemented? i'm assuming it's going to be a nightmare because the script would need to look at a windows timestamp instead of a unix timestamp. also, since the links are hard-coded on the index page, i'm assuming that would have to be re-written?? the only example i've found similar to what i'm trying to do was at php.resourceindex.com. unfortunately, the link lead to a dead page. any suggestions greatly appreciated. UPDATE: i've gotten the timestamp thing down, or so i think. i'm using this code: <?php $filemod = filemtime(department 1); $filemodtime = date("F j, Y", $filemod); Print("Updated $filemodtime"); ?> which outputs the following: Updated August 5, 2002 so, what i need to find out now, is whether it's possible to limit this script to only print output if the directory modification date was less than 30 days before today. for instance, if the script runs & sees that the timestamp on the directory is August 1, 2002, it would output: Updated August 1, 2002 otherwise, if it saw that the timestamp was March 1, 2002, it would output nothing at all. does that make sense? is something like that possible? thanks! __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

« previous php.general (#111316) next »