table object outputting before things that were called prior - 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: table object outputting before things that were called prior (/showthread.php?tid=54133) |
table object outputting before things that were called prior - El Forum - 08-23-2012 [eluser]php_princess[/eluser] When I run this controller it outputs the table before outputting the header. Why is this? Code: class Home extends CI_Controller table object outputting before things that were called prior - El Forum - 08-23-2012 [eluser]Aken[/eluser] Because the print() function in your controller is outputting things before the Output class does, which is where your view content goes when you use $this->load->view(). You should do the $logged_in check in your view, not the controller. table object outputting before things that were called prior - El Forum - 08-24-2012 [eluser]php_princess[/eluser] How's this? I'm not printing from the controller anymore. home controller Code: if (!$logged_in) home/dynamic.php Code: <?php print $table; ?> table object outputting before things that were called prior - El Forum - 08-24-2012 [eluser]Aken[/eluser] Better! |