Putting everything together |
[eluser]Lobosque[/eluser]
Hello CI community. I'm trying to learn how to use CI and its my first time with MVC. I have a simple question: Lets say I have a authentication control with functions like login, register, and logout. so I can login like www.example.com/authentication/login Also, I have a control that take care of some data manipulation. The control name is data and it has two functions: list_items and add_item. So i can list my item trough www.example.com/data/list_items. O.K, now comes my problem: How to put everything together? In my index page, I want a login form in the right column, I want to list all items in the main column and I also want the little add_item form in the left column. I could create a control named authentication_data and a function inside it named list_items_add_items_login. But of course that this is not the right solution. Can someone explain me how is the best way to do it? I hope i ilustrated well what is my doubt. Thanks!
[eluser]rdjs[/eluser]
If you are just starting out I would probably use one of the auth libraries to begin with, this may simplify things a bit.
[eluser]Lobosque[/eluser]
rdjs Thanks for your reply. I tried DX_auth and I learned a lot with it. But I still confused about using 2 or more "things" together... Like the login of DX_auth and the list_items function (of my previous example).
[eluser]rdjs[/eluser]
In your controller you do a check to make sure the person is logged in then you an do whatever you want. Although I have not used DX Auth it looks like this function is called is_logged_in() so... Code: function index() |
Welcome Guest, Not a member yet? Register Sign In |