21490 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2800 Views |
-
XML content-type header

29 May 2010 at 10:11am
I'm creating an XML file in a SS template. The issue I'm having is that the content-type being sent is text/html.
I've tried a number of things but I'm assuming that there must be some way to from my controller class or the template file or something, to define what the content-type ought to be.
Many thanks in advance.
-
Re: XML content-type header

29 May 2010 at 2:05pm
You can use addHeader() to add a header to the response of a particular controller action
function action() {
$this->response->addHeader("Content-Type", "application/xml");
}And you need to make sure your xml has a valid xml header tag.
-
Re: XML content-type header

3 February 2011 at 4:56am
It is best to put this inside init(), like this:
class XML_Controller extends Page_Controller {
public function init(){
$this->response->addHeader("Content-Type", "application/xml");
parent::init();
}
}
| 2800 Views | ||
|
Page:
1
|
Go to Top |


