CodeIgniter Forums
having trouble with controllers - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: having trouble with controllers (/showthread.php?tid=53361)

Pages: 1 2

having trouble with controllers - El Forum - 07-23-2012

i have checked config.php and found the settings to match as you have stated,

I have put .htaccess files in both the application directory and the home directory, because I am unsure where it should be placed. Should it be the code you provided alone?

I have posted simply the information you have supplied within the .htaccess file and have attempted urls such as, which yields "not found" pages.

however, , and other corresponding pages still work.

pages.php controller:

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

class Pages extends CI_Controller {

public function index()

public function view($page = 'home')

// show an error ir the page doesnt exist for some reason  
if ( ! file_exists('application/views/pages/'.$page.'.php'))
  // Whoops, we don't have a page for that!
//Capitalize the first letter of the title
$data['title'] = ucfirst($page);

// load all the helpers and libraries to be used  

$config['base_url'] = '';
$config['total_rows'] = 300;
$config['per_page'] = 3;

// load all the sections of the page

$this->load->view('templates/header', $data);
$this->load->view('templates/navbar', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);



having trouble with controllers - El Forum - 07-23-2012

here are my current routes, or attempt to try what has been suggested, thus far the only
way im navigating to pages such as , pages/home does not work with combinations that have been suggested, or as i have miss?understood them.

//$route['pages/pmsystem/(:any)'] = 'pages/pm/$1';
// i disabled the above just to see if it was affecting below
$route['pages/pmsystem'] = '/pages/pmsystem.php';
// pages/pmsystem yeilds not found
$route['(:any)'] = 'pages/view/$1';
// when i use the route below, rather than the route above,
// index.php/login loads blank pages, and pages/login loads
// not found
//$route['page/:any'] = 'pages/view/$1
$route['default_controller'] = 'pages/view';
/* End of file routes.php */
/* Location: ./application/config/routes.php */

having trouble with controllers - El Forum - 07-23-2012

here is also a pastebin to my config.php file