List of available hooks in Code Igniter and their uses

First hook in the sequence of seven hooks run by Code Igniter on every request of a web page. Benchmark and hook classes have been loaded at this point. No routes have been run at this time.

Second hook run after the pre_system hook. Routing, security checks have been made and base classes have been loaded. However no controller has been run at this point of time.

Third hook run after pre_controller hook. This hook is called after the constructor of a controller has been called but prior to any method calls happening.

Called immediately after your controller is fully executed.

Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This allows you to alter/modify the HTML before sending to the browser. A nice example would be to remove any white space characters from your HTML so that it reduces the size of the HTML.

Very useful hook if you want to override the _display_cache() function to display fresh or other information instead of the cache taken by Code Igniter.

Called after the final rendered page is sent to the browser. You can use this function to cleanup any open files or data in database tables which had served its purpose after the output of the page is sent to the browser.

Be the first to comment

Leave a Reply