php - CodeIgniter question -


I am thinking of using CodeIgniter for a new project. I was reading a user-guide for CI and I saw a few things In all its examples, they put all the arguments in the controller and simply use the model to get and set up the data. I like keeping all my arguments in my model.

For all 3 parts (models, views and controllers) all their functions are universal or if the models are trying to argue in the opposition

In addition, All variables are accessible for 3 parts (models, views and controllers). If I wanted to know if the user was logged within the scene, would I have to pass that information to the controller to see it or is it already accessible within the scene?

In addition, I saw that session data is stored inside the cookies, even if they are encrypted. Is encryption safe enough to use, the use of BOZ is more used to use sessions, apart from how long these cookies are stored by default? I was a bit confused about that part, if someone could clean it.

If you have any other tips to help you learn this new framework, then I appreciate it. Edit

Just read about Kohana, I think I see more in it

They put all the logic in the controller and use the model to get the data and set the model.

Codeigner is expected to have very little logic in its model, and instead you have a very dumb SQL representation to represent your data, to cover the simple arrays of POD types. It puts too much verification code in the controllers, which (in my opinion) is wrong and repetitive. I have rolled my own solution for model recognition and dynamic search method in Rail-style,

// inside the model: // username should be 8 to 25 characters long - & Gt; Validity_land_off ('username', 8, 25); // Dynamically __call () $ this- & gt; User- & gt; Handled by find_first_by_username ('john'); // Return Object or empty $ this-> User- & gt; Search (); // select * $ this-> User- & gt; Search_b_group ('admin'); // Return 0 or more records

But there is no way to do the same thing with AFAIK codeigner.

In addition to this, the variables available for all 3 parts are not

; You must manually pass your view manually to your view with your controller, and there is no sharing of the variable with model / controller or model / views.

I believe that the method suggested by CodeIgniter:

  & lt ;? Php function user () {$ data ['user'] = $ this- & gt; User- & gt; Search (); // Controller logic should use $ data ['user']; Verbose and annoying $ it- & gt; Load-> Views ('Users / Index', $ data); // $ users defined to see}}? & Gt;  

can be corrected by using the PHP's compact keyword:

  & lt; Php function user () {$ users = $ this- & gt; User- & gt; looks like (); // Now we can make $ users more easily this $ & $; Load-> See (users '/ index', compact ('user')); }? & Gt;  

I saw that the session data is stored inside the cookies

The session can store session data in the CodeIgniter database; See config / config.php in $ config ['sess_use_database'] . There are other configuration settings related to the lifetime of the session cookie.

I want to say that only one thing, codeigner, read more about their documentation (actually a language-independent SQL cover that is not to do anything with an active record pattern)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -