CS6320:  SW Engineering of Web Based Systems

 

Code Ignitor (php framework)

Controller = program that responds to HTTP request

1) When install get directory structure

  • CodeIgniter
    • system
      • application
        • config
        • controllers
        • errors
        • models
        • scripts
        • views

2) Right click on contollers->New File

3) Name = MyContoller.php

choose template = empty file

 

<?php
//must extend Controller and class must start with capital letter

class MyController extends Controller {

//main function in controll is index

function index()
{

echo 'hello world'
}


}

?>

 

 

 

3) URL http://whatever.com/CodeIgniter/index.php/MyController/index

this calls the index function in the MyController class

 

 

© Lynne Grewe