Welcome Guest, Not a member yet? Register   Sign In
Novice question about Output class
#1

[eluser]Unknown[/eluser]
Hi,

I am a novice in CI and i have questions about some solutions, the first is:

I have a function like this in my controller:

Code:
function testAjax()
{
    $this->output->set_header('Content-type: text/xml');
    $this->output->set_output('&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;<root>content</root>';
}

but i know i can do somethink like that:
Code:
function testAjax()
{
    header('Content-type: text/xml');
    echo '&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;<root>content</root>';
}

the second solution use only php core functions.

Do you agree that the second solution is better (faster, portable)?
Is there any motive to use first solution?
#2

[eluser]Pascal Kriete[/eluser]
I could see the first one as being more useful in an if statement, but to be honest I never use either feature. Output is what views are for.




Theme © iAndrew 2016 - Forum software by © MyBB