Displaying Category: Cakephp

Rogue lines in CakePHP

So you're using CakePHP and you're looking at the HTML (or RSS or whatever else) source that's being returned and you see a rogue line (CR/LF) as the first line in the source. You look through all of your templates and can't find anything obviously outputting this blank line... What could it be?

Try looking in your routes.php file. I found that two blank lines at the end of the routes.php file will, for whatever reason, output a blank line at the top of everything that CakePHP outputs.

The reason this is especially bad is because, in the case of RSS at least, a blank line will invalidate the XML content so it doesn't look like a feed to a feed reader.
Comment on this Article Anonymously

Please note: Comments posted anonymously will be submitted for moderation. Your email address will not be posted.

Allowed tags: <p>, <strong>, <em>, <img>, <a>, <blockquote>, <pre>, <code>, <ul>

expand