Welcome Guest, Not a member yet? Register   Sign In
New to CI

Hi all,

In my search for a framework I have finally come across CI. I previously used cake -- and it seemed to 'locked down'. Everything seemed black and white with it. I am already liking CI and how it loosely handles everything.

I do have a few starting questions.

Session management -- the package available within CI is an absolute no no. Whats up with storing the data in a cookie?
Regardless, I tend to prefer using a custom session handler which works with the database. This runs transparently in the background, and as such I still access my session data through the $_SESSION vars. Is there any reason I should not follow this practice within CI?

I was basically just thinking of creating it as a library, and loading this library on every page that I need to work with sessions. If you have any advice of things I should avoid or 'should do instead'... let me know.

MVC Logic -- pages.
I am having some problems understanding the MVC logic when it comes to where everything 'goes'. Please take the following example.
Lets say I have a registration form and for this form I need to verify that the 'username' does not already exist in the database.

If I understand this correctly, it would be as follows (psudo code):
function usernameExists($username)
SELECT username FROM accounts WHERE username = $username;
if rows > 0
return false;
return true;
end if;

load (validation)
$rules['username'] = 'required|usernameExists';

function callback_usernameExists($username)
return model::usernameExists($username);

Sorry about the psudo code, and please ignore the syntax (I can gurentee its not exactly what its suppose to be, hehe). I hope the idea is there though.

Basically, the model is the one to do the database interactions, so the controller is the one who must talk to the model which returns its findings to the controller so the controller can return the models findings to the validation routine (false makes it fail).

Thanks for the assistance and would appreciate some feedback.

Messages In This Thread
New to CI - by El Forum - 07-28-2008, 11:07 AM
New to CI - by El Forum - 07-28-2008, 12:51 PM
New to CI - by El Forum - 07-28-2008, 02:42 PM
New to CI - by El Forum - 07-29-2008, 01:10 PM

Theme © iAndrew 2016 - Forum software by © MyBB