PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$sitemap = "";
foreach( $finalurl as $key => $value){
$sitemap .= '<url><loc>http://www.$mainsiteurl.com/$finalurl[$key]</loc><changefreq>daily</changefreq><priority>0.9</priority></url>';
}
echo $sitemap; // for testing
This should work to build your sitemap as long as your array $finalurl is also working properly. Give it a test and see. The .= adds to the previous value of $sitemap (concatenation). If you used just =, then it would replace the previous value. So: