⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

problem with controller



kelli
  • profile picture
  • Member

Posted 03 December 2013 - 12:50 PM

Hello I'm writing the code at my main controller but when i try to open it in local connection appears only "Welcome to the super secret section, admin" (that's from: echo 'Welcome to the super secret section, ' . $user['username']; in the controller)

That's my controller:

 

<title>admin - pcrm</title>
<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
 
class Admin_controller extends CI_Controller {
    
    public function index() {
        
        // in case you did not autoload the library
        $this->load->library('auth');
        
        if (!$this->auth->loggedin()) {
            redirect('login');
        }
        
        // get current user id
        $id = $this->auth->userid();
        
        // get user from database
        $this->load->model('user_model');
        $user = $this->user_model->get('id', $id);
        
        
       echo 'Welcome to the super secret section, ' . $user['username'];
      
        $this->load->views('templates/header');
        $this->load->views('templates/navbar');
        $this->load->views('templates/footer');
        
    }
 
}

  and that's the view:

 

 <!-- Fixed navbar -->
      <div class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
              <a class="navbar-brand" href="#"><strong>Πτυχιακή Εργασία</strong></a>
          </div>
          <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
              <li class="active"><a href="#">Home</a></li>
              <li><a href="#episkopisi">Επισκόπηση</a></li>
              <li><a href="#logariasmoi">Λογαριασμοί</a></li>
              <li><a href="#epafes">Επαφές</a></li>
              <li class="dropdown">
                <a href="#diaxeirisi" class="dropdown-toggle" data-toggle="dropdown">Διαχείρηση <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="#xristes">Χρήστες</a></li>
                  <li><a href="#roloi">Ρόλοι</a></li>
                  <!--<li class="divider"></li>
                  <li class="dropdown-header">Nav header</li>
                  <li><a href="#">Separated link</a></li>
                  <li><a href="#">One more separated link</a></li>-->
                </ul>
              </li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    

Am i doing something wrong or i forget something?


kelli
  • profile picture
  • Member

Posted 05 December 2013 - 13:47 PM

i fixed the problem by deleting my controller and making a new one!