Output buffering error... But why? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Output buffering error... But why? (/showthread.php?tid=35189) |
Output buffering error... But why? - El Forum - 10-21-2010 [eluser]stormbytes[/eluser] I'm trying to error-trap the details() method below, so that prior to outputting a view, it checks (against the database) to see if the args are valid. First it checks to see if args have been provided altogether, and if not, it redirects the user to the catalog() controller. This part works fine, which is all the more baffling! Next, it checks to see if the details() method's args are indeed valid by calling a model-method. This is the part that generates an error. I don't understand why this is happening as the $this->load->view statement only appears if BOTH conditions are not met. So as far as I see it, there's no output prior to that. Error Message: Code: A PHP Error was encountered Class Method details() Code: function details($asset_id = array()) { Code: function get_asset_url($asset_id) { Output buffering error... But why? - El Forum - 10-21-2010 [eluser]cahva[/eluser] As I dont know exatcly what goes on in the rest of your controller, I assume the method's parameter should not be an array. Also I think you should just get the row with all the fields you need in one go from model. Try this(I dont know if it will work as I said I dont know the big picture). asset_mod model: Code: function get_asset($asset_id = FALSE) details method from your controller: Code: function details($asset_id = FALSE) Was this what you were after? Output buffering error... But why? - El Forum - 10-21-2010 [eluser]stormbytes[/eluser] Beautiful - Yeah, pretty much. That's what I love about asking questions on the CI forum - You learn a lot more then just the solutions to your problem. I'll refactor some of my classes applying your technique. Clean, simple and much more efficient use of code! Thanks for the lesson - Output buffering error... But why? - El Forum - 10-21-2010 [eluser]stormbytes[/eluser] Been fiddling with this code... Haven't seen '->row()' appended to a query like that before. What exactly does this function return? (array, resource, etc) How would use use this in the View? EDIT - NM, got it. User Guide is my friend! |