Vote count:
0
Im loading different contents in my main view with my menu, the code is working properly but is i have this error message.
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant users - assumed 'users'
Filename: views/welcome.php
Line Number: 53
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant stores - assumed 'stores'
Filename: views/welcome.php
Line Number: 56
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant notes - assumed 'notes'
Filename: views/welcome.php
Line Number: 59
This is my view
<div id="nav">
<div id="imagesBox">
<a href="index.php?section=users"><img class="imagesLeft" src="images/usuario_on.png"></a>
<a href="index.php?section=stores"><img class="imagesLeft" src="images/tienda_on.png"></a>
<a href="index.php?section=notes"><img class="imagesLeft" src="images/aviso_on.png"></a>
</div>
<?php
$section; $users=0;
switch ($_GET['section']) {
case users:
$this->load->view('users');
break;
case stores:
$this->load->view('stores');
break;
case notes:
$this->load->view('notes');
break;
}
?>
</div>
And this is my controller (im using tank_auth and is working properly)
class Welcome extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
}
function index()
{
if (!$this->tank_auth->is_logged_in()) {
redirect('/auth/login/');
} else {
$data['user_id'] = $this->tank_auth->get_user_id();
$data['username'] = $this->tank_auth->get_username();
$this->load->view('welcome', $data);
}
}
}
I dont find the best method to fix this and this is a little weird, because the code is working like i want.
asked 16 secs ago
Aucun commentaire:
Enregistrer un commentaire