- From SEO point of view, to make URL SEO friendly and get more user visits
- Hide some URL element such as a function name, controller name, etc. from the users for security reasons
- Provide different functionality to particular parts of a system
Code Ignitor Tutorial
Today Deal
Why configure the URL routes?
How to add model in controller?
Within your controller functions, models will typically be added/load; you will use the function
- $this->load->model (‘Model_Name’);
MVC Pattern
CodeIgniter framework is based on MVC pattern. MVC is a software that gives you a separate logical view from the presentation view. Due to this, a web page contains minimal scripting.
- Model - The Controller manages models. It represents your data structure. Model classes contain functions through which you can insert, retrieve or update information in your database.
- View - View is the information that is presented in front of users. It can be a web page or parts the page like header and footer.
- Controllers - Controller is the intermediary between models and view to process HTTP request and generates a web page. All the requests received by the controller are passed on to models and view to process the information.
What is inhibitor in Codeignitor?
what is hooks & How many types of hooks?
CodeIgniter’s Hooks feature provides a way to modify the inner workings or functionality of the framework without touching the core files.
The following types of hooks:
- pre_system Called very early during system execution.
- pre_controller Called immediately prior to any of your controllers being called.
- post_controller_constructor Called immediately after your controller is instantiated, but prior to any method calls happening.
- post_controller Called immediately after your controller is fully executed.
- display_override Overrides the _display() method.
- cache_override Enables you to call your own method instead of the _display_cache() method in the Output Library. This permits you to use your own cache display mechanism.
- post_system Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser.
what is helper and how to load helper?
Helpers is type of file that help you with tasks.Each helper file is simply a collection of functions in a particular category.They are simple, procedural functions.Each helper function performs one specific task, with no dependence on other functions.
CodeIgniter does not load Helper Files by default, so the first step in using a Helper is to load it. Once loaded, it becomes globally available in your controller and views.
Helpers are typically stored in your system/helpers, or application/helpers directory
In CodeIgniter, you will find many helpers like URL helpers- helping in creating links, Text helpers- perform various text formatting routines, Cookies- helpers set and read cookies.
Loading a helper file is quite simple using the following method:
$this->load->helper('name');Where name is the file name of the helper, without the .php file extension or the “helper” part.
Features of Code ignitor
- Framework with a small footprint
- Simple solutions over complexity
- Clear documentation
- Exceptional performance
- Strong Security
- Nearly zero configuration
Why configure the URL routes?
Changing the URL routes has some benefits like From SEO point of view, to make URL SEO friendly and get more user visits Hide some URL ...
-
CodeIgniter’s Hooks feature provides a way to modify the inner workings or functionality of the framework without touching the core files. T...