Parsing error when trying to write an RSS feed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Parsing error when trying to write an RSS feed (/showthread.php?tid=22467) |
Parsing error when trying to write an RSS feed - El Forum - 09-10-2009 [eluser]kenny.katzgrau[/eluser] Hey guys, awesome framework. I was making a view file which was essentially a template for an RSS feed. At the top of the feed template, I had: Code: <?xml version="1.0" encoding="utf-8"?> I found that my server was interpreting the <? ?> in the xml declaration was being picked up by the PHP interpreter, so instead, I wrote: Code: <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> But I got parsing errors from my RSS reader because a mysterious semicolon was being placed before all closing ?>, even though it was in the closed string being echo'd. The put it plainly, Code: <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> is produced as: Code: <?xml version="1.0" encoding="utf-8"; ?> Which I think might be a result of CodeIgniter trying to add semi-colons to unterminated statements. I do have the <?= shorttags enabled. My final solution, although pretty hacky, was to use: Code: <?php echo '<' . '?xml version="1.0" encoding="utf-8"?' . '>'; ?> Parsing error when trying to write an RSS feed - El Forum - 09-12-2009 [eluser]pistolPete[/eluser] Did you enable "Rewrite PHP Short Tags"? If so, try disabling it. Code: $config['rewrite_short_tags'] = TRUE; |