/*
|MODELS
||usersdb.php
|CONTROLLERS
||users.php
the model and controller can then have different methods eg, add a user, remove a user, view all users etc.
*/
class Usersdb extends Model
{
/**
* The Initialisation method
*/
function Usersdb()
{
parent::Model();
}
function add($name)
{
...
}
function delete($userid)
{
...
}
}
class User extends Controller {
function User()
{
parent::Controller();
$this->load->model('usersdb');
$this->load->scaffolding('users');
}
function add()
{
$name = 'test';
$res = $this->usersdb->add($name);
$data['res'] = $res;
$this->load->view('users/user_add_v', $data);
}
function delete($id)
{
$res = $this->usersdb->delete($id);
$data['res'] = $res;
$this->load->view('users/user_remove_v', $data);
}
/*
so to add a user you would use the URL
whatever.com/codeigniter/index.php/user/add
*/