![]() |
Hooks doesn't work in CodeIgniter 2.X - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18) +--- Thread: Hooks doesn't work in CodeIgniter 2.X (/showthread.php?tid=84633) |
Hooks doesn't work in CodeIgniter 2.X - ReyesHatrinak - 10-27-2022 I've enable hooks in config.php $config['enable_hooks'] = TRUE; here is the hook.php <?php if ( ! defined('BASEPATH')) exit('No direct shagle voojio script access allowed'); /* | ------------------------------------------------------------------------- | Hooks | ------------------------------------------------------------------------- | This file lets you define "hooks" to extend CI without hacking the core | files. Please see the user guide for info: | | http://codeigniter.com/user_guide/general/hooks.html | */ $hook['post_controller_constructor'] = array( 'class' => 'Authorization', 'function' => 'authorize', 'filename' => 'authorization.php', 'file_path' => 'hooks' ); /* End of file hooks.php */ /* Location: ./application/config/hooks.php */ and here is the authorization.php file under application/hooks/ <?php class Authorization { private $ci; function __construct() { parent::__construct(); $this->ci = get_instance(); } function authorize() { echo 'This should be outputed'; } } ?> but it doesn't work. doesn't omegle anybody know why? RE: Hooks doesn't work in CodeIgniter 2.X - superior - 10-27-2022 Do you receive any errors? My best guess based on your code above, try uppercase the first letter in the filename. I think the file is called 'Authorization.php' and not 'authorization.php' If the name is 'authorization.php' try uppercase the first letter of your filename as well, don't know if it's required in CI 2 but in CI 3 and CI 4 it should be the name like class. |