Welcome Guest, Not a member yet? Register   Sign In
Library or helper?
#1

[eluser]Gijs Bloemen[/eluser]
Hi all,

I am creating my first application in CodeIgniter. I am busy with the login system of the application and I have a problem. I do not know as wich 'type' of file you have to save the login check of the application? So the function that is loaded on every page to check of a user is loged in or not. Does this need to be theoretical a library or helper?

Regards,
Gijs Bloemen

P.S. Excuse me for my bad English..
#2

[eluser]Dam1an[/eluser]
Most auth libraries have it in both, with the helper just being a convenience function, which calls the is_logged_in function in the library.

In my application, I just use the helper, which returns the value from the session (my auth library is very lightweight, and all within the auth controller

It's just a matter of personal preference
#3

[eluser]ok3x[/eluser]
I approve.. The choice is yours.

Usually I place the auth "logic" as part of user model which methods are called by controller. The login state is stored within session (and can be eventually checked by helper function).

If your auth functionality grows complex, it is fine to build a standalone library..

Hope that helps :-)
#4

[eluser]gtech[/eluser]
[url="http://ellislab.com/forums/viewthread/111840/"]http://ellislab.com/forums/viewthread/111840/[/url]
[url="http://ellislab.com/forums/viewthread/96273/"]http://ellislab.com/forums/viewthread/96273/[/url]
[url="http://ellislab.com/forums/viewthread/85353/"]http://ellislab.com/forums/viewthread/85353/[/url]

etc. Smile




Theme © iAndrew 2016 - Forum software by © MyBB