![]() |
Sending output to browser - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Sending output to browser (/showthread.php?tid=18887) |
Sending output to browser - El Forum - 05-21-2009 [eluser]steelaz[/eluser] Based on certain conditions, I want to break in the middle of controller and send custom output to the browser. I found a way to do this using private function _display() in output class, but perhaps there is proper way of doing it? This is what I use right now: Code: $this->output->set_header($json_header); Sending output to browser - El Forum - 05-21-2009 [eluser]Jondolar[/eluser] I don't think you need to call the _display() function. Just don't display anything else after you set the output. Sending output to browser - El Forum - 05-21-2009 [eluser]steelaz[/eluser] You're right, I don't have to, but I would prefer it to keep my coding style. This is what I like to do: Code: if ($step1 == FALSE) Instead of coding like this: Code: if ($step1 == TRUE) But in this case, instead of redirecting on error I'd like to send custom output. Sending output to browser - El Forum - 05-21-2009 [eluser]Colin Williams[/eluser] How about loading a view? I think I'm missing the problem. |