Codeigniter is a very simple and easy to learn PHP framework. Codeigniter follows the modern coding architecture called MVC. MVC stands for Model, View, and Controller. It separates the application into three main components.The model contains all data transaction related logic. The view contains logic about how to display the data which is called UI Logic and very most important the controller, the controller acts as a pool between this two components .You can learn more about MVC on web. Now we focus on our main subject.
In this series of codeigniter tutoria,l we are going to learn codeigniter step by step starting from how to install codeigniter.
Step 1 :-
1.Download the codeigniter from here.
2 .Extract the content of zip file into your projects root directory.No extra dependencies are needed at this time.
3. Now we have to configure our .httaccess file. copy the below givent code and create a file with no name and .htaccess extention. put this file in root directory of your project .In our case ,it will be C:/xampp/htdocs/example
RewriteEngine On RewriteCond $1 !^(index\.php|assets|images|css|js|uploads|favicon.ico) RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME) !-d RewriteRule ^(.*)$ ./index.php/$1 [L]
The above given .htaccess code redirects the all requests to index.php.
Step 2 :-
1.Now we have to cofigure codeigniter.In this example ,we are using example as the root directory of our project.
2. Use any text editor to start building your codeigniter project . we are using SUBLIME TEXT 3.
Configuring codeigniter :-
The above image contains the directory structure of the codeigniter project. All files needed to develop a web application resides in application folder.we will discus folder structure later . first, we will configure codeigniter .
1.Go to c:/xampp/yourprojectname/application/config folder and open config.php file in your text editor.
2.Set your projects base_url and if you does not want to display your index.php file then clear the content of $config['index_page'].
$config['base_url'] = 'http://localhost/example/'; $config['index_page'] = '';
3. The above given code are the basic setting which you have to set in the config.php file .
4. start xampp and go to your browser and type localhost/yourprojectname in URL address bar of browser .you will see the welcome message when you successfully installed Codeigniter.