// web sites loop
for ($i = 0; $i < count($smap); $i++) {
Echo "Working on Web Site ID #".$smap[$i]['id']."
";
$xmlfile1 = "testsitemap-" . $smap[$i]['id'] . "-page1.php";
$xmlfile2 = "testsitemap-" . $smap[$i]['id'] . "-page2.php";
$xmlfile3 = "testsitemap-" . $smap[$i]['id'] . "-page3.php";
$xmlfile4 = "testsitemap-" . $smap[$i]['id'] . "-page4.php";
$xmlfile5 = "testsitemap-" . $smap[$i]['id'] . "-page5.php";
$fh1 = fopen($xmlfile1, 'w') or die("can't open");
$fh2 = fopen($xmlfile2, 'w') or die("can't open");
$fh3 = fopen($xmlfile3, 'w') or die("can't open");
$fh4 = fopen($xmlfile4, 'w') or die("can't open");
$fh5 = fopen($xmlfile5, 'w') or die("can't open");
for ($f = 0; $f < count($smap[$i]['general']); $f++) {
// general links
Echo "Text:".$smap[$i]['general'][$f][0]." Link:".$smap[$i]['general'][$f][1]."
";
$stringData .= "" . $smap[$i]['general'][$f][0] ."
";
$count++;
if ($count < 100) {
fwrite($fh1, $stringData);
$stringData = '';
}
if ($count == 100) {
echo "
Hit 100
";
if ($count > 100) {
fwrite($fh1, $stringData);
$stringData = '';
fclose($fh1);
}
}
if ($count == 200) {
echo "
Hit 200
";
fwrite($fh2, $stringData);
$stringData = '';
fclose($fh2);
}
if ($count == 300) {
echo "
Hit 300
";
fwrite($fh3, $stringData);
$stringData = '';
fclose($fh3);
}
}
// echo count($smap[$i]['general']);
for ($g = 0; $g < count($smap[$i]['locations']); $g++) {
// location
Echo "Location:".$smap[$i]['locations'][$g]."
";
for ($s = 0; $s < count($smap[$i]['location_links'][$smap[$i]['locations'][$g]]); $s++) {
// location links
Echo "Text:".$smap[$i]['location_links'][$smap[$i]['locations'][$g]][$s][0]." Link:".$smap[$i]['location_links'][$smap[$i]['locations'][$g]][$s][1]."
";
$stringData .= "" . $smap[$i]['location_links'][$smap[$i]['locations'][$g]][$s][0] ."
";
$count++;
if ($count == 100) {
echo "
Hit 100
";
fopen($xmlfile1, 'a') or die("can't open");
fwrite($fh1, $stringData);
$stringData = '';
fclose($fh1);
}
if ($count == 200) {
echo "
Hit 200
";
fwrite($fh2, $stringData);
$stringData = '';
fclose($fh2);
}
if ($count == 300) {
echo "
Hit 300
";
fwrite($fh3, $stringData);
$stringData = '';
fclose($fh3);
}
if ($count == 400) {
echo "
Hit 400
";
fwrite($fh4, $stringData);
$stringData = '';
fclose($fh4);
}
if ($count == 500) {
echo "
Hit 500
";
fwrite($fh5, $stringData);
$stringData = '';
fclose($fh5);
}
}
}
}
echo $count;
?>