CodeIgniter Tutorial for Beginner: Part 1 – Getting Started

CodeIgniter is a web application framework for PHP. It enables developers to build web applications faster than writing it from the scratch. It provides us rich set of libraries and helpers for commonly needed task.

In this tutorial, you are going to be shown basic how to set up the framework, include how to build basic hello world using the MVC approach. MVC is an architectural pattern used in software engineering which stands for Model, View and Controller.

  • Model deals with database interaction and contains functions like inserting/deleting records to a database or selecting specific database records.
  • View deals with displaying the data, and while
  • Controller controls what is sent to the view from the model.  In CodeIgniter, the controller is also the place to load libraries and helpers.

Step 1:

In order to start, we will need to download CodeIgniter and upload it to your local/remote server. Direct your browser to CodeIgniter and click the large download button. For this tutorial we are using CI version 2.0.3

Step 2:

Once we have downloaded CodeIgniter, all we need to do is to extract it, and rename the folder either to codeigniter or to whatever you prefer. I personally like to name it as application with prefix ci_ e.g ci_tutorial1. In my case, I am using web server for localhost, so I upload into Xampp’s htdocs folder and only application, system folder and index.php file and it will look like

Expand the application folder. We will find many folders, for simplicity sake our concern are only config, controller and views folders.

Step 3:

Now, for development step, we will use Netbeans 7.01 as IDE, but feel free to choose whatever IDE you like even as simple as notepad.

  • Open your Netbeans, and click New Project or Ctrl+Shift+N
  • Choose PHP application with Existing Source as your new Project then browse folder that we already created before in htdocs and click next until we are done.

Step 4:

When we execute to see if our CI is up and running properly. Go to http://localhost/ci_tutorial1/ or right click on the project->run  and we should see the following.

Step 5:

If we are up and running, now we need to modify the welcome_message.php in the view’s folder. Replace with

[html]<h1>Hello World!</h1>[/html]

we should see something like this below

We are Finito!

One Response to CodeIgniter Tutorial for Beginner: Part 1 – Getting Started

  1. I’ve been surfing online more than three hours lately, but I never found any fascinating article like yours. It’s pretty worth sufficient for me. In my opinion, if all webmasters and bloggers made excellent content material as you did, the web will likely be a lot more helpful than ever before.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">