If you look at: http://forums.xisto.com/no_longer_exists/
You can see it produces an error like this:
Parse error: syntax error, unexpected T_STRING in /home/chesso/public_html/tools/google_sitemap_generator.php on line 65
This page however works perfectly using WAMP5 locally on my pc (may have something to do with it using a newer version of PHP).
Anyone see a problem with this? It's just to generate a basic Google Sitemap, something built out of boredom based on my own sitemap.xml file meh >_>.
I just see the problem with your code, simple replace the ',' with a ';' like this:
len=urls_array.length;for ( var i=0; i<len; ++i )And also i suggest to complete your script tag.
I just have the same error.
This one only seems to work locally.
It appears to be a problem with me setting result = "<?xml blah blah", it doesn't like the code in it.
Which should be void because it's outside of the php tags and is inside quotes. Iv'e even tried a few different ways of quoting it (single out, double in, double out, single in etc).
EDIT: It loads fine without this:
// Initial result value to begin with. result = "<?xml version=1.0 encoding=UTF-8?>\n<urlset xmlns=https://www.google.com/schemas/sitemap/0.84&%2339;;
Obviously there should be double quotes for the atributes inside that string, I tried single quoting outside and double quotings inside and others but still get the error.
The problem is short tags <?xml..., which is why I think servers should have it turned off, and people should use the proper <?php.
To overcome it you would need to do this:
result = '<'+'?xml version="1.0" encoding="UTF-8"?'+'>'+"\n"+'<urlset xmlns="https://www.google.com/schemas/sitemap/0.84/;;or
result = <?php echo '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'."\n".'<urlset xmlns="https://www.google.com/schemas/sitemap/0.84/;; ?>Cheers,
Yep that's what I ended up doing.I also always use <?php and ?>, I have seen many problems because of only using <?, I guess short tags must have been turned off. I think it is turned off by default on my local setup.