How do I handle views loaded based on conditions correctly? - 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: How do I handle views loaded based on conditions correctly? (/showthread.php?tid=42562) |
How do I handle views loaded based on conditions correctly? - El Forum - 06-10-2011 [eluser]Unknown[/eluser] I am making a system to help manage bills for a friend (and practice at CI). It will require you to login, then once to login it will take you to the overview page showing an overview for each months bill for the current year. I currently have the controllers layed out like this: Code: /auth/ - Brings up the login screen Now I am wondering how I am supposed to correctly transition between the user correctly logging in -> bill overview. Or, generally speaking, the transition from from the job of one controller to another (My /auth/ controller, from what I understand, is not supposed to have anything to do with displaying a bill overview). I currently have a redirect setup to go back and forth but it seems there must be a better way. Thanks, Thomas How do I handle views loaded based on conditions correctly? - El Forum - 06-10-2011 [eluser]bhumes[/eluser] Redirecting is the way to go. Code: $this->load->helper('url'); How do I handle views loaded based on conditions correctly? - El Forum - 06-10-2011 [eluser]Unknown[/eluser] [quote author="bhumes" date="1307755807"]Redirecting is the way to go. Code: $this->load->helper('url'); Good to know Would it be a bad idea to extend the CI controller to include an authorization method that redirects to /auth/ if not logged in? This way I don't have to do Code: if (!is_authorized()) { in every controller? Also, thanks for the reply. Edit: I just implemented something like that, doing: Code: class MY_Controller extends CI_Controller { seems to work nicely. |