Problem with filemtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm doing dynamic generation of a Google sitemap. The important  
(albeit truncated) code is as follows:


$file_list = get_sitemap($directory,$file_list); # Function that  
loops through the site and gets all of the file names
$file_list = explode('|',$file_list); # The list of files is pipe (|)  
separated
array_pop($file_list); # The last array value is blank because of the  
way the loop in the function above works

for ($i=0;$i<count($file_list);$i++) {
         echo $file_list[$i].' .:. ';
         echo date ("F d Y H:i:s.", filemtime('../about- 
us.html')).' .:. TEST<br />'; # The ../ is because this file is  
running in a subdirectory and for proof of concept that it's working
         echo date ("F d Y H:i:s.", filemtime($file_list[$i])).' .:.  
TEST<br />';
         echo date ("F d Y H:i:s.", filemtime('../about- 
us.html')).' .:. TEST<br />'; # The ../ is because this file is  
running in a subdirectory and for proof of concept that it's working
}


The problem is that when filemtime hits the *first* file in *any*  
directory, it bombs for that file, with this error:
Warning: filemtime() [function.filemtime]: stat failed for [file name  
would be here]

A couple of notes:
1. The two '../about_us.html' lines are there to nail the first file  
it is trying to get the time from.
2. Doing filemtime with the file name directly typed into filemtime  
works fine.
3. I also did a string comparison on the directly typed name vs. the  
array version of the name, and they are *exactly* the same.
4. I tried doing file opens, directory opens, and pretty much  
anything else I could come up with to possibly "initialize" access to  
the various directories, but it didn't make any difference.
5. I googled and did my due diligence for filemtime and the error  
message, but
5. I also tried a bunch of canned scripts for generating Google  
sitemaps, but none of them really worked for my purposes.


Any insight any of you can provide is greatly appreciated.

If you've got a really good script that automatically grabs all file  
names, file mod times, and has a file ignore list, I'd love to see  
it. Like I said, nothing I found seemed to be very solid and didn't  
work very well.
--
Joe

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux