Welcome Guest, Not a member yet? Register   Sign In
Trying to view a XML instead of PHP or HTML file
#4

[eluser]Phil Sturgeon[/eluser]
[quote author="attos" date="1227666792"]I use CI to provide a RSS feed using Derek Allard's tutorials.
It's avalable from his site.
I had an issue with the view with the closing xml tag.
I had to replace it with
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
echo "<?xml version=\"1.0\" encoding=\"utf-8\" \x3F>\n"
?>
This is a known issue documented here.[/quote]

Put the code above at the top of your view file, and add the following in your controller to set the headers correctly.

Code:
$this->output->set_header('Content-Type: text/xml; charset=ISO-8859-1');

Make sure that's done before your view file, and before any content is being output. If you do have anything being output, you'll need to clear the output buffer (wipe the screen), which can be done with:

Code:
while (@ob_end_clean());


Messages In This Thread
Trying to view a XML instead of PHP or HTML file - by El Forum - 11-25-2008, 06:44 AM
Trying to view a XML instead of PHP or HTML file - by El Forum - 11-25-2008, 07:27 AM
Trying to view a XML instead of PHP or HTML file - by El Forum - 11-25-2008, 02:33 PM
Trying to view a XML instead of PHP or HTML file - by El Forum - 11-26-2008, 10:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB