Skip to content

Instantly share code, notes, and snippets.

@arunoda
Created June 22, 2012 04:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arunoda/cb51e330dd663069687f to your computer and use it in GitHub Desktop.
Save arunoda/cb51e330dd663069687f to your computer and use it in GitHub Desktop.
Codeigniter - Extending Core Class
<?php
class Hello extends MY_Controller {
public function index() {
echo $this->model->foo();
}
}
<?php
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
$controller = get_class($this);
$model = $controller . '_model';
$this->load->model($model, 'model');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment