Apply for Zend Framework Certification Training

Codeigniter






                        HOW TO USE CUSTOM HOOK POINTS WITH CODEIGNITER

In this article I will explain the process of implementing a custom hook point infrastructure allowing you to place custom hook points throughout functions in your controllers. This comes in handy when you want people to be able to modify a CodeIgniter application without modifying the original controller files. The result is similar to the way WordPress lets developers modify it without changing the core files.
CodeIgniter comes with a built-in hook structure, however the available hook points are defined by the framework and it’s not possible to add your own hook points. By default, there are only 7 hook points available
What we want though, is the ability to add hook points wherever we’d like. Since this functionality is not supplied by CodeIgniter, I had to make a few tweaks.

The first steps are virtually the same compared to implementing regular CodeIgniter hooks.

STEP1: MAKE SURE HOOKS ARE ENABLED

For hooks to be functional, we have to instruct CodeIgniter to enable the hook functionality. This is done by editing the main configuration file (typically located in /application/config/config.php) and set $config[‘enable_hooks’] to TRUE instead of FALSE.

< First Getting Started With CodeIgniter URL Routing >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top