![]() |
Question about loading module within view - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Question about loading module within view (/showthread.php?tid=8601) |
Question about loading module within view - El Forum - 05-23-2008 [eluser]Dave S[/eluser] I'll start by saying I am still very new to CI and quite new to php in general, so sorry for the n00b question. I have a header that displays on every page of my site. In the header I want a login form, or if the user is logged in, a welcome message. I have searched other posts and I guess HMVC seems to be the best way to do this. I created a little test controller in application/modules/controllers called login.php. Should this controller handle the POST data when people log in, AND decide whether to display the login form or the Welcome message? I can't see any other way to do it. And an even more n00bish question - I can't even get the header view to load the module ![]() Code: echo modules::run('login'); I looked through the example on the wiki but I'm afraid the remapping was a bit over my head. (Sorry if this is not posted in the right place. I guess I should have posted in the Modular Extensions thread.) Question about loading module within view - El Forum - 05-23-2008 [eluser]Dave S[/eluser] I figured out why it won't load the module (sort of). I tried placing login.php in application/controllers and it worked. Shouldn't modules go in application/modules/controllers though? Question about loading module within view - El Forum - 05-23-2008 [eluser]wiredesignz[/eluser] Hi Dave, Welcome to CI Forums. Your module controllers can be placed in either application/controllers or application/modules/{$module_name}/controllers. Hope this helps. Question about loading module within view - El Forum - 05-23-2008 [eluser]Dave S[/eluser] Ah, of course. Thank you! |