controllers/admin/clogin.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* Author: Jorge Torres
* Description: Login controller class
*/
class Clogin extends CI_Controller{
function __construct(){
parent::__construct();
}
public function index(){
// Load our view to be displayed
// to the user
$this->data['assets'] = array('logincss' => base_url().'assets/css/login.css',
'logo2' => base_url().'assets/images/logo2.png'
);
$this->load->view('admin/login', $this->data['assets']);
}
public function process(){
// Load the model
$this->load->model('login_model');
// Validate the user can login
$result = $this->login_model->validate();
// Now we verify the result
if(! $result){
// If user did not validate, then show them login page again
$this->index();
}else{
// If user did validate,
// Send them to members area
redirect('home');
}
}
}
?>
routes.php
/* admin */
$route['admin/login'] = 'admin/clogin';
views/admin/login.php
<link href="<?php echo $logincss; ?>" rel="stylesheet" type="text/css" media="screen">
<div id="logoadmin"></div>
<div id="loginbox">
<img src="<?php echo $logo2; ?>" width="150">
<br><br>
<div id="username">
<br><br>
<div id="position">
Username: <input type="text" name="username"><br><br>
Password: <input type="password" name="password">
</div>
<br>
<div id="submit"><input type="submit" value="login" class="button"></div>
</div>
</div>
I wonder why the stylesheet and the logo does not show up?