Revision: 9772
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 21, 2008 02:41 by antoniomax
Initial Code
/*
|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
*/
Initial URL
http://codeigniter.com/forums/viewthread/76840/
Initial Description
Initial Title
CI sample models / controlers structure
Initial Tags
Initial Language
PHP