CodeIgniter Forums

Full Version: Creating a full Application (Users controller)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Deltawar[/eluser]
Hi I have a question when creating a full fledged website.


How do I access user related queries in my 'USERS' controller like retrieving user data and checking if the user is logged in when I am on a page for example...'MAIN'

for example im in my 'main' page controller but want to make sure the user is logged in via the method 'is_logged_in' which is located in my 'user' controller

how do i access my user controller from my main controller?


Sorry if this doesnt make sense im just not too sure on how to word it.

El Forum

[eluser]PhilTem[/eluser]
It's simple: You don't.

You have to put that logic into a library or model to make it accessible within many other controllers.


PS: You may use HMVC and then call the controller's method, but if you just started using CI you better don't be using HMVC on top.

El Forum

[eluser]Deltawar[/eluser]
thanks for the reply Smile

off to create a library Smile

One other question as I have an active thread...

In other frameworks for example symfony you can create 'plugins'

is creating a 'library' the same as that (assuming different frameworks have different fancy ways of saying make a class and put it in a seperate folder...)

Or are there also 'actual plugins' for codeigniter and other frameworks also, and by actual plugins i mean software or app attachments.