Sorry about that, I had modified it little bit, but forgot...
Here the complete code:
<?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); ?>

  ]
}


Br
Olav B. Lygre

On Jan 26, 7:24 pm, TML <[email protected]> wrote:
> I have looked at Gearpad code. In Manifest.php the files are still
> statically listed. I thought, I could be wrong, that Yossi wanted a
> way to dynamically list the files in the web app for the manifest.json
> file.
> Please tell me what I am missing.Thanks.
>
> On Jan 5, 8:14 pm, Oblygre <[email protected]> wrote:
>
> > You can build a dynamic manifest file and put in on the server, and
> > all files within one or several directory(s) can be automatically
> > updated in the manifest file.
> > See the manifest.php in the gearpad sample for a nice example of this.
>
> > Good luck!
>
> > Br Olav B. Lygre
>
> > On Jan 4, 11:30 am, yosrbnrt <[email protected]> wrote:
>
> > > Hi,
> > > I am new to google gears.
> > > I would like implement google gears for a big section of our site -
> > > which has static content - including html pages, PDF files, etc' in
> > > order for our sales team to use the content offline......
> > > I understand i should build build a manifest json file including all
> > > the URL's of my pages, images, PDF files etc'.....
> > > Is there a way I could include a group of URL's at once to make it
> > > easier? could I define a section in the site to be stored? for example
> > > if i have all my PDF files underwww.domain.com/PDF/couldIinclude
> > > all the files at once? or must I define each and every file in the
> > > manifest file?
>
> > > Thanks,
> > > Yossi.

Reply via email to