How to start with codeigniter and it’s easy tutorials

How to start with codeigniter

After searching  in some Forums  and many  websites of CodeIgniter . some doughts about how to organized of CodeIgniter and how can it help you. Firstly people should know, CodeIgniter is a PHP framework which is based on MVC (Model-View-Controller)  architecture. This architecture provide separates  login from UI (User Interface) which is allowing Independent development, Testing, and Better Maintenance. On my opinion , It is very user-friendly. So I would recommend to use it. Now start it.

How to install CodeIgniter

Installation it’s very easy in CodeIgniter. Just follow some step given below:-

Step 1 : Firstly download the CodeIgniter from this link .

  1. CodeIgniter comes in three flavors: CodeIgniter 3 (current), CodeIgniter 4 (future) and CodeIgniter 2 (legacy) download.
  2. Also available script on Github.

Step 2 : Download zip file to unzip file.

Step 3 : Upload  unzip folder and file on server.

Step 4 : After uploading file on server visit URL of site. ( or localhost/yoursitename).

Config File :

Config file can be found on root :

Application->config->config.php . Change only one line of code for simple example.

Route File:

Next thing that change our routes file. This file can also be found same as path our config file.

Application->config->routes.php. in this file,we would change or set our default controller. Then we are going our first page “home”, this is name of first controller which is set to routes file,  open by default.

Now let’s  understand  example.

Controller :

Controller is intermediate between the Model , the View and any other resources to process HTTP request and web page.

Let’s  create our home controller. Controller are PHP classes that are within the floder Controller. Each class should have the same name as it’s file name. And each class will extent of codelgniter main controller. See this


?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {


/* End of file home.php */

/* Location: ./application/controllers/home.php */


In this class, one can be a class construct. Construct will run everytime when class is called. PHP used to call class construct functions with the same name as the class. See this



View is frontend part of website  and example which is visitor see of web application. And also provide page fragmentation like a header or footer and any other  page.


Filename: home_view.php

html lang=en xmlns=''>Example of Date Display

Hello World.


If you want fragmentation  on this view file , then create  two file. One is called header.php and other  footer.php. and this code devided by two part . the header file should look something like this.

Filename: header.php

		Example of Date Display		

And footer file should look.

Filename : footer.php

If  you want put some css file on our website then include in header section (header.php). and other js file include to footer section (footer.php). and look as

Filename : home_view.php


Within controller, we would need to call the ‘view’ function to display content of main content file to the browser. Let’s create index function in home controller.

Filename : home.php

Also ,we will call another file template.php. this template file load header , footer content and also display main content. We will create an array named $data[]. This will be associative array, with data that will display on template file. Which content to load.


Filename : template.php




And also send variable of today date. Let’s see.

Filename : home.php

We can access variable $today, it was sent data throught $data[].

Filename : home_view.php

Now try to this steps. Hope you all enjoy.







Categories: Codeigniter

Leave A Reply

Your email address will not be published.

error: content is protected !!