C

Simplified tutorials to learn the popular basic language C

VB.Net

Learn the basic desktop development application language

CodeIgniter

One of the popular PHP three tier (MVC) framework

How to Create and Run a CodeIgniter Project


Tip Abstraction:
          This is an introduction tutorial for one of the popular PHP framework CodeIgniter.


CodeIgniter, one of the famous PHP Framework for creating PHP MVC Projects. The first version of CodeIgniter was released on Feb 2000 and which is still popular on these days. This is a RAD (Rapid Application Development) PHP framework, enables you to make your PHP codes structured with MVC model.

Introduction to CodeIgniter PHP MVC Framework

What is MVC?

MVC stands for Model View Controller. There are the three main parts of the three tire architectural projects. Instead of writing PHP codes, HTML design and database codes in single page, MVC enables you to write all three parts in separate three files.
M – Model => Contains database related codes such as connections strings, SQL queries, etc.
V – View    => Contains design codes such as HTML, CSS, JavaScript etc
C – Controller => Contains main core codes of PHP.

Advantages:

  • Rapid development
  • Structured coding
  • Reduce code complication 
  • Well performance
  • Coding simplicity
  • Reduce future correcting complexity

Before Starting: 

Before starting to learn the framework, you should understand that, this is a PHP framework. So you must learn the basics of the PHP programming language such as server side scripting, local hosting software like WampServer, Basic PHP codes, etc.

Let’s Start

First of all, you need to download the basic framework kit of CodeIgniter from their official site. Try to download their latest version.


Installation:

  • You will get a zip file.
  • Now just turn on your WampServer (or local hosting software) and open your local host folder ‘www’.
  • Extract CodeIgniter files and rename the folder with your new project name. (Look at the picture, renamed with ‘myproject’).
CodeIgniter main folder


You have to use separate CodeIgniter files for each projects. So keep your master files safe.
Now if you open your folder, then you can see like this:

CodeIgniter framework structure

 If you can see again another folder with name CodeIgniter, then just make your folder arrangement like above for better coding.
  • Now installation is over.

After Installation:

Just look at ‘Application’ folder, this is your master folder. Open the folder, now you can see many folders including your MVC folders such that Models, Views and Controllers.

CodeIgniter Application Folder


Running a CodeIgniter Project 

You can run your project like running a PHP plane project.

  • Open WampServer localhost.
Running a CodeIgniter PHP Project
  • Now just click on your ‘project folder name’. Sometimes you might type ‘localhost/yourprojctname’. Here: ‘localhost/myproject’. Then hit enter key.
Running a codeigniter project
  • Now if you get like this, then your CodeIgniter framework works well, if else, you got some error while installation or running.

First CodeIgniter running output

Let us start to write coding in next lesson.


No comments:

Post a Comment