Welcome Guest, Not a member yet? Register   Sign In
How to prevent error message coz by already sent out header information
#1

[eluser]RaiNnTeaRs[/eluser]
How to prevent error message coz by already sent out header information. I was told that the echo lines, caused the error. But sometimes, I really needs the echo command. How to bring the echo lines together with the session command class ? Thanx
#2

[eluser]Pascal Kriete[/eluser]
There are a few actions (redirects for one) that don't allow any thing to have been sent to the browser. What you can do is buffer the output. To add something to the end of the CI output buffer do:
Code:
$this->output->append_output('whatever');
#3

[eluser]RaiNnTeaRs[/eluser]
hmm...but can i do something without stacking my output ?
I mean... i get error message if I put the echo command sometimes..But can I do the echo command after creating the session in my controller files ? I get the error message for puting my echo command before creating sessions. THankx
#4

[eluser]gtech[/eluser]
yes you can put the echo after creating the session, as the echo calculates if it needs to send a header or not, where as setting a session has to send a header for it to work.

I would add echoing content in the controller is not really good practice unless you are using it for debug. the alternative is to log your errors.
#5

[eluser]gedev2006[/eluser]
im not sure if this is good practice or not, but it works!

take this class as an example

Code:
class Test {

  function Test() {

  }

}

if you add:

ob_start();

before the class is defined like so:

Code:
ob_start();
class Test {

}

This will stop the error !




Theme © iAndrew 2016 - Forum software by © MyBB