Help with sitemap_xml

edited July 2012 in News & Announcements
Hi,

I am not sure what should I do with the sitemap_xml view or layout files?

If I try to open it in the browser on my local machine localhost/clarenssa/sitemap I get this error:
XML Parsing Error: XML declaration not well-formed
Location: http://localhost/clarenssa/sitemap_xml.php
Line Number 1, Column 37:<?xml version="1.0" encoding="UTF-8"; ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
------------------------------------^

What should I actually do with these files?

Thanks

Comments

  • edited 3:20AM
    If you view the source of the page, what does it actually output do you know?

    The sitemap_xml.php file is there if you want to dynamically create your sitemap.xml file. There are various ways to pull in the locations of the pages (e.g. you can use fuel_nav to pull in all the pages in the navigation, you can query the pages_model to get all the pages saved in the CMS by using the pages_model::all_pages_including_views method). Then in the config/routes.php file, you can uncomment the line about the route to the sitemap.xml.
  • edited 3:20AM
    I'm having the same problem. It looks like when the script outputs the start XML tag it drops an extra character in it.. ";"...

    http://brookstowninn.jbwebservices.com/help_sitemap_xml.jpg

    echo '<?xml version="1.0" encoding="UTF-8"?>';

    becomes

    <?xml version="1.0" encoding="UTF-8"; ?>

    Windows, IIS Express... FireFox and Chrome
  • edited 3:20AM
    Change the layout code to the following:
    echo str_replace(';', '', '<?xml version="1.0" encoding="UTF-8"?>');
    There is an old comment in the code for the fuel/application/views/sitemap_xml.php view file that says:
    "needed because of the Loader class mistaking the end of the xml node as PHP in load->view"
  • edited 3:20AM
    great! works now!
Sign In or Register to comment.