Let’s Use Code Igniter 2 part 1

Let’s start all with download the source from
*FYI I download the CodeIgniter V 2.0.1*
try to extract your zip into htdocs of your local. Then try to change the name (the name will be CodeIgniter V 2.0.1) into whetever you like. Since we work on the local, we must to minimize the editing.

The very basic of this tutorial is to build you first page. Actualy you can follow above image (change welcome.php) and erase everything then type

Hello world

let’s skip it and begin to make your new page. I already upload my first lesson. You can download in MEDIAFIRE. Just extract and name diffently.. you can my code in here.

Go to Application/views
in this folder we will see the welcome_message.php this is the place we should be put our template (view) for next. We need to make home.php create one empty and we have like this.

Edit the home.php and type this

Since the code should be simple, I suggest you type from Header (8) to body (10). If you want to simple just copy paste home.php in my work project.

This step should be done first but I think we can change a little bit
Go to config folder (above view) and search for routes.php

Search this sentence

Change into this.
*welcome into home*
With this change, the first page should be load is home. But this not over yet..

In order to read home, you must need controller. We need home controler and it can be found in this folder. Create new file name home.php and edit it

This is the code I type. If you copy paste the code from my example. Copy the index2 and I will explain about it next. this controller only make data that will show in view .. This is the step above

  1. the code will  read index. Remember what extends this use. Older just type Controller, but now we need to type CI_controller
  2. the model will be download
  3. add data
  4. show view with the data
Next we will try to show other than index, But today we use index.. there is one more file we need to add. it is the model

Goto models then try to make new file (home_model.php). basicly is wise to make home but is not wise if you open all home realted, you will be confuse. Better to make

  • for controller is home.php
  • model home_model.php
  • view home_view.php

Just type like this. This model only to have data only, we can use database. but today learning is not database, we can try random number. reload and you will this

Congratulation you made your own simple page.
*not simple but worth it*
next we will try another way to build simple page


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: