adho12 Posted August 6, 2013 Share Posted August 6, 2013 HiSorry to bother you once again, but I’m having a Problem here and am too stupid for the internet…So I’m trying to create an Dynamic Cache Manifest for my (offline) Web-AppI’m using this http://grinninggecko.com/dynamic-cache-manifest/ version… <?php // Add the correct Content-Type for the cache manifest header('Content-Type: text/cache-manifest'); // Write the first line echo "CACHE MANIFESTn"; // Initialize the $hashes string $hashes = ""; $dir = new RecursiveDirectoryIterator("."); // Iterate through all the files/folders in the current directory foreach(new RecursiveIteratorIterator($dir) as $file) { $info = pathinfo($file); // If the object is a file // and it's not called manifest.php (this file), // and it's not a dotfile, add it to the list if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") { // Replace spaces with %20 or it will break echo str_replace(' ', '%20', $file) . "n"; // Add this file's hash to the $hashes string $hashes .= md5_file($file); } } // Hash the $hashes string and output echo "# Hash: " . md5($hashes) . "n"; ?> And for some reason it doesn’t work…. Thanks and I hope you could help me… P.S. sorry for my english Quote Link to comment Share on other sites More sharing options...
Ice IT Support Posted August 6, 2013 Share Posted August 6, 2013 Could you please include a link to the HTML page with the manifest? Also try replacing the line towards the top echo "CACHE MANIFESTn"; With echo "CACHE MANIFEST\n"; Quote Link to comment Share on other sites More sharing options...
adho12 Posted August 6, 2013 Author Share Posted August 6, 2013 Sorry still no good... Quote Link to comment Share on other sites More sharing options...
Ice IT Support Posted August 7, 2013 Share Posted August 7, 2013 What error does it give you? Could you please include a link to the page on your site? Quote Link to comment Share on other sites More sharing options...
adho12 Posted August 7, 2013 Author Share Posted August 7, 2013 The main problem is that it doesn't give an error and still nothing is stored...(the address is http://ahornung.tk/mob/ )Am I using it wrong?... Thanks for your help... Quote Link to comment Share on other sites More sharing options...
adho12 Posted August 7, 2013 Author Share Posted August 7, 2013 ok it works now... <?php header('Content-Type: text/cache-manifest'); echo "CACHE MANIFEST\n"; $hashes = ""; $lastFileWasDynamic = FALSE; $dir = new RecursiveDirectoryIterator("."); foreach(new RecursiveIteratorIterator($dir) as $file) { if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") { if(preg_match('/.php$/', $file)) { if(!$lastFileWasDynamic) { echo "\n\nNETWORK:\n"; } $lastFileWasDynamic = TRUE; } else { if($lastFileWasDynamic) { echo "\n\nCACHE:\n"; $lastFileWasDynamic = FALSE; } } echo $file . "\n"; $hashes .= md5_file($file); } } echo "# Hash: " . md5($hashes) . "\n"; ?> Thanks Quote Link to comment Share on other sites More sharing options...
Ice IT Support Posted August 7, 2013 Share Posted August 7, 2013 Glad it's working! Quote Link to comment Share on other sites More sharing options...
adho12 Posted August 8, 2013 Author Share Posted August 8, 2013 Thank you for your help ^^ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.