My RSS feed is being interpreted as download? |
[eluser]taewoo[/eluser]
Hi all. I followed Derek's tutorial on how to create RSS feed with CI. With my feed, i try to load it in the browser, the browser asks me to download.. Is this a header issue? (By the way... browser screenshot attached) Controller: Code: $data['encoding'] = 'utf-8'; View Code: <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
[eluser]benofsky[/eluser]
Hi, try this for the header instead: Code: header("Content-Type: application/xml"); Since as far as I know application/rss+xml doesn't exist (from my research). Good luck
[eluser]taewoo[/eluser]
Thans Ben... But now I get this error (from FireFox .... IE just doesnt't display at all) Code: XML Parsing Error: xml declaration not at start of external entity
[eluser]taewoo[/eluser]
Ok I think I got it. Spaces. Damn spaces in the controller causing all sorts of weird behavior.
[eluser]alectrash[/eluser]
My solution is to get rid of the xml declaration at start of the doc here Code: <?xml version='1.0' ?> Code: header('Content-Type: text/xml; charset=utf-8'); The feed will still validate according to www.feedvalidator.org and validator.w3.org. Problem solved?
[eluser]taewoo[/eluser]
hey alectrash It was space issue. For some reason if you have spaces outside of XML tags, it causes this problem...
[eluser]alectrash[/eluser]
Sorry it is a space issue correct, yes. I was just simply pointing out that removing the xml declaration solves the problem. Have you found a way to solve the problem and keep the xml declaration by any chance. If so could you specify. Would be very much appreciated.
[eluser]taewoo[/eluser]
this works for me Code: <?php
|
Welcome Guest, Not a member yet? Register Sign In |