CodeIgniter Forums
Hooks Not Working Correct - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Hooks Not Working Correct (/showthread.php?tid=64223)



Hooks Not Working Correct - wolfgang1983 - 01-29-2016

I have enabled hooks. 

And I use a pre_controller

PHP Code:
$hook['pre_controller'] = array(
 
   'class' => 'Maintenance',
 
   'function' => 'index',
 
   'filename' => 'Maintenance.php',
 
   'filepath' => 'controllers/common/',
); 

PHP Code:
<?php

class Maintenance extends CI_Controller {

    public function 
index() {
        if (
$this->config->item('maintenance') == TRUE) {
            
$this->load->view('theme/default/template/common/maintenance_view');
        }
    }


When the maintenance config item is true it should over ride the current view and display maintenance view. But does not still displays the home controller view.

I have autoloaded my setting.php config file


PHP Code:
<?php

$config
['maintenance'] = TRUE


Then when is false should disable it.