Loading controllers from within controller - 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: Loading controllers from within controller (/showthread.php?tid=53698) |
Loading controllers from within controller - El Forum - 08-04-2012 [eluser]sanguina[/eluser] How do i load a controller from within a controller. For example, I am using tank_auth library which has a controller called auth which calls a view called login_form to display the login form page. Now I want to display this login form in the top of the homepage. the home page is displayed by another controller called home_controller how do i call the auth controller from the home-controller. Please help Loading controllers from within controller - El Forum - 08-04-2012 [eluser]pisio[/eluser] from home_controller to call method in it with him ? Code: class home_controller extends ci_controller { If i udenterstand you corectly Loading controllers from within controller - El Forum - 08-04-2012 [eluser]sanguina[/eluser] thanks for replying.. but what if my method one is already present in say b_controller .. do i have to write the method one again in home-controller. isn't there a way i can call method one in b_controller from home_controller ? Loading controllers from within controller - El Forum - 08-04-2012 [eluser]Mirge[/eluser] I believe he's wanting to call a different controller's method from the current controller. I think that's what HMVC allows? <waits patiently for someone more experienced in that area to respond....*cough* cronix, insite..> Loading controllers from within controller - El Forum - 08-04-2012 [eluser]sanguina[/eluser] yes precisely what i wanted. a search on HMVC lead me to some articles - but i dont think - i need to go all the way to create spearate M-V-C for each module. What i am asking for is an everyday phenomena on websites - including the way its displayed here at the top of this forum. All i want is to display the login form at the top of each page and if the user is logged the form is replaced by some welcome message - like "Hello Username". thanks a lot - i am new to ci - read through most of the tutorials - but nothing that came close to answering this issue. Loading controllers from within controller - El Forum - 08-05-2012 [eluser]ppwalks[/eluser] why not just define the is_logged_in method from the auth library and echo the difference if that makes sense Loading controllers from within controller - El Forum - 08-05-2012 [eluser]NeoArc[/eluser] Create a base controller in the application/core/ directory: Code: <?php _head() will be available in all descendants of MY_Controller Code: class Blog extends MY_Controller{ |