public and private controller |
[eluser]Mutsop[/eluser]
Hi, I have a few controllers which should only be accessed using by logged users. Now I thought I needed only to set the check (if user is logged in) in the index function of the controller. Apparently that doesn't work when you try to input the url directly of the other functions. So i've been reading throughout the web and found out there would be a possibility to use some public or private controller? Is this correct? and how? If so, what about if some functions should be able to be accessed and some not in the same controller?
[eluser]Cristian Gilè[/eluser]
Check if user is logged-in in the controller constructor: Code: class Controller_name extends Controller or you can put the check in the admin controller so you don't need to call the condition in every controller constructor: Code: class MY_Controller extends Controller Code: class Admin_Controller extends MY_Controller Non admin pages will extend MY_Controller and admin pages will extend Admin_Controller. Phil Sturgeon wrote an useful tutorial Cristian Gilè |
Welcome Guest, Not a member yet? Register Sign In |