Welcome Guest, Not a member yet? Register   Sign In
Question about loading module within view
#1

[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 Smile It tells me that it is "Unable to locate the requested module: login". I have the modules helper autoloaded, and I called the module within the view like so:
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.)
#2

[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?
#3

[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.
#4

[eluser]Dave S[/eluser]
Ah, of course. Thank you!




Theme © iAndrew 2016 - Forum software by © MyBB