Ok.. So let me ask. 1) Is "C:/Program Files/Apache Software Foundation/Apache2.2/ htdocs/gearsTut/manifestTest/test" the directory that you want to get files from?
If yes, then change the directory name to: "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/gearsTut/ manifestTest/test/." <-- notice the /. after "test". http://us3.php.net/manual/en/function.dirname.php (php.net's docs page on using dirname()) 2) If the above doesn't work, what kind of output are you getting from using the above? On Jan 28, 3:29 pm, "Tosca Lahiri" <[email protected]> wrote: > Thanks, but I have tried that and it doesn't work either. TML > > > -----Original Message----- > > From: [email protected] [mailto:[email protected]] > > On Behalf Of carise > > Sent: Wednesday, January 28, 2009 11:14 PM > > To: Gears Users > > Subject: [gears-users] Re: manifest.php folders > > > Sorry, bad explanation on my part. > > > Have you tried: > > > $dirs[1] = dirname("C:/Program Files/Apache Software Foundation/ > > Apache2.2/htdocs/gearsTut/manifestTest/test"); > > > On Jan 28, 2:12 pm, "Tosca Lahiri" <[email protected]> wrote: > > > Thanks for the suggestion. > > > I have tried: > > > $dirs[1] = dirname("http://localhost/gearsTut/manifestTest/test", > > > "C:/Program Files/Apache Software > > > Foundation/Apache2.2/htdocs/gearsTut/manifestTest/test"); > > > > And: > > > $dirs[1] = dirname("/gearsTut/manifestTest/test.", > > > "C:/Program Files/Apache Software > > > Foundation/Apache2.2/htdocs/gearsTut/manifestTest/test."); > > > > And: > > > $dirs[1] = dirname("/gearsTut/manifestTest/test", > > > "C:/Program Files/Apache Software > > > Foundation/Apache2.2/htdocs/gearsTut/manifestTest/test"); > > > > But still not listing files in sub directory. I have tried changing > > round > > > $dirs[0] and $dirs[1] in case only the first dir was being read but that > > > just gave me the files in the home dir. > > > > Any more suggestions? > > > TML > > > > > -----Original Message----- > > > > From: [email protected] [mailto:gears- > > [email protected]] > > > > On Behalf Of carise > > > > Sent: Wednesday, January 28, 2009 9:48 PM > > > > To: Gears Users > > > > Subject: [gears-users] Re: manifest.php folders > > > > > I think the dirname for your home/test directory is supposed to be a > > > > filesystem path (e.g. "/www/apache/htdocs/gearsTut/manifestTest/test", > > > > "C:/apache/htdocs/gearsTut/manifestTest/test"). Perhaps give that a > > > > try? > > > > > On Jan 28, 1:16 pm, "Tosca Lahiri" <[email protected]> wrote: > > > > > Thanks but it hasn't worked in my example. It implodes the files in > > the > > > > home > > > > > directory but not in the home/test directory. Will you look at the > > code > > > > > again please: > > > > > > $version = 0; > > > > > $dirs = array(); > > > > > $dirs[0] = dirname($_SERVER['SCRIPT_FILENAME']); > > > > > $dirs[1] = dirname("http://localhost/gearsTut/manifestTest/test/"); > > > > > > foreach ($dirs as $dir) > > > > > { > > > > > $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 looking into this. > > > > > TML > > > > > > > -----Original Message----- > > > > > > From: [email protected] [mailto:gears- > > > > [email protected]] > > > > > > On Behalf Of carise > > > > > > Sent: Wednesday, January 28, 2009 6:53 PM > > > > > > To: Gears Users > > > > > > Subject: [gears-users] Re: manifest.php folders > > > > > > > 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 <[email protected]> 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
