Reputation: 229
I have got many blogs. I have tried to find a solution why controller is not loading the page and displaying a blank page . But I would not find it useful. But the code works fine in localhost. I don't know why it is so. Unable find a solution. Any help would be appreciated.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Config_test extends CI_Controller {
public function __construct(){
parent::__construct();
if( $this->session->userdata('logged_in') != TRUE ){
redirect('login?reurl='.current_url());
}elseif (!$this->usergroup_model->page_allowed()) {
//This check will ensure that only authorised users can have access to any
//functions present in this controller
//Route all control requests only through config function only
show_error('The url is either wrong or the inputs are inadquate. Please navigate with the help of menu bar only...');
die();
}
$this->moduleID = '3';
$this->menu['main_menus'] = $this->usergroup_model->menu_access();
$this->menu['sub_menus'] = $this->usergroup_model->submenu_access($this->moduleID);
$this->menu['module_name'] = $this->usergroup_model->module_name($this->moduleID);
$this->load->vars($this->menu);
$this->load->model('model_1');
$this->load->model('model_2');
$this->load->model('model_3');
}
function index(){
$this->config();
}
function config($action=null)
{
//If customer ID is null... redirect to dashboard...
if($this->session->userdata('dashboard_customer_id') == null)
redirect('dashboard');
switch ($action)
{
case 'add':
$this->add();
break;
case 'add_save':
$this->add_save();
break;
case 'add_success':
$this->add_success();
break;
case 'edit':
$this->edit();
break;
case 'edit_save':
$this->edit_save();
break;
case 'edit_success':
$this->edit_success();
break;
default:
$this->edit();
break;
}
}
function add()
{
//doing some function
}
function add_save()
{
//some code
}
function add_success()
{
//some code
}
function edit()
{
//some code
}
function edit_save()
{
//some code
}
function edit_success()
{
//Not used here...
}
}
And this is my url http://localhost/tester/index.php/Config_test
Upvotes: 1
Views: 114
Reputation: 37711
Apache is case-sensitive by default, so:
http://localhost/tester/index.php/Config_test
should be lowercase:
http://localhost/tester/index.php/config_test
Of course, keep the controller class name capitalized.
Upvotes: 0
Reputation: 3740
May be mod_rewrite
is not enabled on server.
enable mod_rewrite
on server
Upvotes: 1
Reputation: 82
The problem can be caused by many thinks like a missing extension of php. Have you looked into error logs. Maybe if you provide some more info I can be able to help you. What is the version of php you are using in localhost and the live system.
Upvotes: 0