CodeIgniter Framework - Part 2
NOTE: THIS TUTORIAL IMPLYS YOU HAVE READ OVER [Only registered and activated users can see links. ]

Creating Our Very First Site
In this part, we'll be working with the MVC(Model/View/Controller) system. Browse to application/controllers/. You will see welcome.php, we'll be using this default controller to setup a redirect to a brand new controller, so open up welcome.php.

Next we want to go to the function index() { } and put at the top inside the function
What does index()/redirect()/base_url() do?
The Base Controller looks for a index() function so it knows how to start out the page in the routing system.
redirect() is basically header(), but its simpler.
base_url() is simply the base url(ex: (Note: base_url() adds trail ending slash (ex:

Creating our Very First Controller
Lets create a new file in application/controllers/ and call it first.php, in first.php enter the following content:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class First extends CI_Controller { /* First = name of controller */

	 * Index Page for this controller.
	 * Maps to the following URL
	 *	- or -  
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/first/<method_name>
	 * @see
	public function index()

/* End of file first.php */
/* Location: ./application/controllers/first.php */
What does $this->load->{option} do?
In the $this->load, we have multiple options, the main ones you will be using is $this->load->view(), $this->load->model() (once loaded it translates to $this->modelname->method()).

Creating our first view
Navigate to application/views/ and create a new file called myfirstview.php
In there enter ANY content you want, for this I simply put:
<html><head><title>My First View</title></head><body>content</body></html>
Now, once we visit our site, then index.php/first/ it will show us this page.

Thats it for part 2, stay tuned for part three(3), where I will show a bit more advanced items like custom routing, RUI, etc.