Tips codeigniter n tricks

I have a php web project due to my college in a couple of days. It costs 75% of my final class. The way the teacher marks us is as follows:

a suitable date will come, we will meet with him at the appointed time and show him what we learned. More or less discussion about what our assessment should be.

This brings me here because he said that the more things we do, the better, the more we get.

This is my question:

"What tips do you have regarding codeigniter? Is there anything you have ever learned about this that you would like to know from the start?" Code snippets, manuals from the Internet somewhere, etc.

And my preference would be for those who have a high ratio of impressions in length over time to study.

+3
source share
6 answers

may be useful ~

Extending base controllers to create an easy-to-use, extensible way to restrict access to your site

admin_controller.php

class Admin_Controller extends MY_Controller {

    function __construct()
    {
        if(!$this->auth->is_Admin()) /* imaginary auth library */
        {
            redirect('login/error');
        }
    }

 // bla bla
} 

template library

Using a good template library can be a google find, there are many. Not for every project, but it can reduce a lot of unnecessary ones $this->load->view('foo);, which will simplify your application.

+7
source

The main thing that I am doing now, what would I not do from the very beginning?



, ORM , . ORM ( , Doctrine) , .

- AwesomeRecord , DataMapper WanWizard.

, CI 2.0. 1.7.x .

+5
$this->db->insert_id();

... , ...

+2

, CodeIgniter User Guide , MVC, , :

- PHP, . , CodeIgniter . , , , .

CI 80% , , . /.

+1

:

+1

Source: https://habr.com/ru/post/1779965/


All Articles