only loop through the list if there's a list

darcs-hash:20080716004414-d018c-dad819f8c5881271f494dd27a073baa05bb7e7bc.gz
This commit is contained in:
Evan Prodromou 2008-07-15 20:44:14 -04:00
parent 1509f3893c
commit b9df342437
1 changed files with 7 additions and 5 deletions

View File

@ -291,11 +291,13 @@ function urlset($urlset_text) {
function array_to_map($url_list, $filename_prefix) { function array_to_map($url_list, $filename_prefix) {
global $output_paths; global $output_paths;
# $map_urls is a long string containing concatenated <url></url> elements. if ($url_list) {
while (list($map_idx, $map_urls) = each($url_list)) { # $map_urls is a long string containing concatenated <url></url> elements.
$urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml"; while (list($map_idx, $map_urls) = each($url_list)) {
$urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
write_file($urlset_path, urlset($map_urls));
write_file($urlset_path, urlset($map_urls));
}
} }
} }