Configuración database.php
Código PHP:
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "myci";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
Código PHP:
$route['default_controller'] = "blog";
$route['scaffolding_trigger'] = "scaffolding";
Código PHP:
class Blog extends Controller {
function Blog(){
parent::Controller();
$this->load->scaffolding('entries');
}
function index(){
$data['title'] = "My blog title";
$data['heading'] = "My first heading";
$this->load->view('blog_view',$data);
}
}
Código PHP:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
</body>
</html>