02-02-2016, 08:08 PM
(This post was last modified: 02-03-2016, 12:49 AM by wolfgang1983.)
Hello I am not sure what I have done wrong with my Hooks
On any other controller if I use $this->config->item('maintenance') or config_item('maintenance')
It returns the correct value 1 if maintenance mode on or 0 for off.
How ever when I try to load it into my hook with $this->CI->config->item('maintenance') or config_item('maintenance')
It does not work. Any suggestion on how to be able to use config item in hooks?
Hook
On any other controller if I use $this->config->item('maintenance') or config_item('maintenance')
It returns the correct value 1 if maintenance mode on or 0 for off.
How ever when I try to load it into my hook with $this->CI->config->item('maintenance') or config_item('maintenance')
It does not work. Any suggestion on how to be able to use config item in hooks?
Hook
PHP Code:
<?php
class Preaction {
public function __construct() {
$this->CI =& get_instance();
}
public function check() {
echo config_item('maintenance');
//if (config_item('maintenance')) {
// echo "On";
// } else {
// echo "Off";
//}
}
}
PHP Code:
$hook['pre_controller'] = array(
'class' => 'Preaction',
'function' => 'check',
'filename' => 'Preaction.php',
'filepath' => 'hooks'
);
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!