Juergen Posted February 8, 2015 Share Posted February 8, 2015 Hello @ all, I couldn´t find the cause why I am always getting a white space at the beginning of my source code. <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="de"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="de"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="de"> <![endif]--> As you can see there is a white space before the doctype declaration (<!DOCTYPE html>). This leads in pages with RSS-markup to errors, because whitespaces are not allowed there. I have not included anything before!! I dont know when this problem started. I use the sitemap module on my site which produce a XML-page. This module was working for a long time without problems. But in the past I always get errors because of the whitespace. It seems that the whitespace problem started either with an update or with the installation of a module. Unfortunately I cannot figure out what the cause could be. Has someone discovered the same behaviour on his site or has someone an idea how to find out the cause of this problem. Best regards Jürgen Link to comment Share on other sites More sharing options...
pjg Posted February 8, 2015 Share Posted February 8, 2015 Afternoon Jürgen, A million and one possible causes: a hook prepending output to anything rendered a rouge echo chucking out a space a simple error in the rendering page (that includes the doctype declaration) a space in an including tag etc. etc. Really without looking at code and systematically ruling out - or somebody who had the same issue with similar modules there's not a lot of hope for a quick fix. Phil EDIT: If you can find the template or include file that includes the line <!DOCTYPE html> that would be a good place to start the hunt. Most likely a head.inc or main.inc Link to comment Share on other sites More sharing options...
Juergen Posted February 8, 2015 Author Share Posted February 8, 2015 Thank you for your prompt answere!! Yes I know that this could be tricky to find out. As I mentioned I use the sitemap module to create a sitemap in a xml format. This module produces a pure sitmap.xml file. So in this case there cannot be included something before. This module has worked for a long time but now there is also a whitespace at the beginning of the XML opening tag (http://www.juergen-kern.at/sitemap.xml). So in this case I have no influence on creating the output code (no include errors and so on) . This module produce the xml markup code on its own but the whitespace is still there. Link to comment Share on other sites More sharing options...
chrizz Posted February 12, 2015 Share Posted February 12, 2015 is it possible that this is an encoding error? Which sitemap module do you use? This one? https://processwire.com/talk/topic/799-module-xml-sitemap/ What happens if you place a die('test'); in the renderSitemap method? Is a whitespace included as well? Anything in the error.log perhaps? My approach would be: Die() whereever you can and try to isolate the problem. good luck! Link to comment Share on other sites More sharing options...
Juergen Posted May 28, 2015 Author Share Posted May 28, 2015 Updating to PW 2.6.0 stable solves the problem - the whitespace at the beginning is gone. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now