Welcome Guest, Not a member yet? Register   Sign In
Core VS Library
#1

[eluser]Unknown[/eluser]
So, I've been working on a project with a forum page for awhile. So, I need to check if a user is logged in, is able to edit/delete their own (or any other if they're, say an admin or moderator) posts etc. My login and forum controllers are separated.

Now, my question is, I've been reading the user guide and some forum posts on this forum, and I'm not sure what I should go with.

Should I create a library containing my custom functions [like check_logged_in()] in application/libraries folder where I need to call CI as a reference [$CI =& get_instance()] or create a MY_Controller file with one or more classes extending CI_Controller in application/core. I got them both work in a way or another, though MY_Controller seems to be a better practice to me as I can directly use $this.

But what confused me is people telling about putting files in application/library on this and some other forums.

How does going with either effect the performance? Or is it a matter of preference?
#2

[eluser]InsiteFX[/eluser]
If you already have an Auth Library just create an auth_helper file and call the methods from it!
#3

[eluser]Unknown[/eluser]
I intend to write my own functions. I now took a look at Tank auth's structure and I see the custom functions are in application/library. I think I'll do the same as well.




Theme © iAndrew 2016 - Forum software by © MyBB