You can specify the directories and use that while loop to add each file to the entries array. I admit I do not really know much php, but here's what I'd try...
$version = 0; $dirs = array (); // 1. create a $dirs array since you will have more than one directory to look through... $dirs[0] = dirname($_SERVER['SCRIPT_FILENAME']); $dirs[1] = dirname("/home/images/."); // 2. add directories foreach ($dirs as $dir) { // 3. now go through all the files in all the directories to get the latest version number based on the files' last modified time $handle = opendir($dir); while (false !== ($file = readdir($handle))) { if (file_exists("$dir/$file")) { $v = filemtime("$dir/$file"); if ($v > $version) { $version = $v; } if ($file<>'..') $files[]=$file; } } } On Jan 28, 8:19 am, TML <t...@toscalahiri.co.uk> wrote: > Hello, > > What would I alter in the following code so that the manifest file > includes files from folders as well as those in the home directory? > For example is I have: > > home/images or home/images/large > > Here is the code (mainly provided by Google and users): > <?php > // Copyright 2007, Google Inc. > // > // Redistribution and use in source and binary forms, with or > without // modification, are permitted provided that the following > conditions are met: > // > // 1. Redistributions of source code must retain the above copyright > notice, > // this list of conditions and the following disclaimer. > // 2. Redistributions in binary form must reproduce the above > copyright notice, > // this list of conditions and the following disclaimer in the > documentation > // and/or other materials provided with the distribution. > // 3. Neither the name of Google Inc. nor the names of its > contributors may be > // used to endorse or promote products derived from this software > without > // specific prior written permission. > // > // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS > OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY > DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE > GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS > INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // > WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE > OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, > EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > header('Content-type: text/plain'); > $version = 0; > $dir = dirname($_SERVER['SCRIPT_FILENAME']); > $handle = opendir($dir); > while (false !== ($file = readdir($handle))) { > if (file_exists("$dir/$file")) { > $v = filemtime("$dir/$file"); > if ($v > $version) { > $version = $v; > } > if ($file<>'..') > $files[]=$file; > }} > > $entries = array(); > foreach ($files as $file) { > array_push($entries, " {\"url\": \"$file\" , \"ignoreQuery\": > true }");} > > ?> > { > "betaManifestVersion": 1, > "version": "<?php echo $version ?>", > "entries": [ > <?php echo implode(",\n", $entries); ?>, > {"url": "manifest.php" , "ignoreQuery": true } > ] > > } > > Thanks for your help. > TML