user1606612
user1606612

Reputation: 27

Codeigniter Only Loading Index Method

I am having some problems with codeigniter, It is only letting me load the index method and not any of the other functions:

My code:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Private_page extends CI_Controller 
{

   function __construct()
   {
      parent::__construct();
      if($this->session->userdata('paramID') === false) {
         redirect('/public');
      }
   }



   public function index()
   {
        /* Header Data */   

        $data = array(
                    'title' => 'Bizispace Private Page',
                    'paramID' => $this->session->userdata('paramID')
                );

        // Load Header
        $this->load->view('template/header.php', $data);

        /* Get Subcriptions Details */

        $this->load->view('private/index.php', $data);
        $this->load->view('template/footer.php');
   }

   public function logout()
   {
        $this->session->sess_destroy();
        redirct('public_page');     
   }
}

?>

I have a route setup:

$route['private'] = "private/private_page";

and then I run: /index.php/private/ it displays the index page fine but if i run /index.php/private/logout I get:

"Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid."

Edit* I am running WAMP on 32 bit windows 7

Am i doing something wrong?

Upvotes: 0

Views: 2013

Answers (1)

Yan Berk
Yan Berk

Reputation: 14428

Add to your routes:

$route['private/(:any)'] = "private/private_page/$1";

Upvotes: 9

Related Questions