Skip to content
C.H edited this page May 14, 2018 · 6 revisions

Extend Load Method

  • skin
  • layout
  • css
  • js
  • _view : view Alias

Usage

class Welcome extends MY_Controller
{
    public function index() {
        $this->load
            ->css(['https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css'])
            ->js([
                ['src'=>'https://code.jquery.com/jquery-3.2.1.slim.min.js', 
                 'integrity'=>'sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN',
                 'crossorigin'=>'anonymous'
                ],
                'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js',
                'src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" crossorigin="anonymous"'
            ])
            ->skin('_skin')
            ->layout->('_layout')
            ->css('common.css')
            ->js('common.js')
            ->_view('welcome_head')
            ->_view('welcome_message', [])
            ->_view('welcome_foot');
  }
}

Process

  1. MY_Controller::__construct() $this->load->driver('straight');
  2. MY_Controller::_output() echo $this->straight->layout->output( $output );
  3. Straight_layout::output()
    1. skin file css, js
    2. layout file css, js
    3. view To Assets push
    4. css add
    5. js <script> add
    6. output minify
Clone this wiki locally