'; $xmlout .= ''; $xmlout .= ' '; // loop over the photos array and build xml foreach($photos as $photo) { $xmlout .= "{$photo[0]}"; if($showImageCaption) { if($showImageLink) { $xmlout .= "{$photo[1]}
View full size...]]>"; } else { $xmlout .= ""; } } $xmlout .= "\n"; } $xmlout .= "
"; // get the time $now = time(); // should we cache the results? if($ttl) { // cache the results so we don't need to keep generating it. $sData = serialize(array($now, $xmlout)); if (!$handle = @fopen($cache, 'w')) { if($debug) { echo "Error: Cannot open $cache for writing.\n"; if(!is_dir(dirname($cache))) { print "The directory " . dirname($cache) . " doesn't exist. Please correct the \$cache variable, or create the directory.\n"; } elseif(is_file($cache) && !is_writable($cache)) { print "The cache file exists, but I can't write to it. Please check the pemissions of this file and try again.\n"; } else { print "Please check the permissions on " . dirname($cache) . " as I don't have write permission here.\n"; } } else { echo "Error: Cannot open cache file"; } exit; } if (@fwrite($handle, $sData) === FALSE) { echo "Error: Cannot write to cache file"; exit; } fclose($handle); } // now return the XML for SimpleViewer header("Content-Type: text/xml"); header("X-Cache-Status: Miss"); header("Last-Modified: " . gmdate("r", $now)); header("Expires: " . gmdate("r", ($now + $ttl))); print $xmlout; exit; ?>