CS6320:  SW Engineering of Web Based Systems

 

Code Ignitor (php framework)

View = program that gives view to client so that do not need to send data directly from client via HTTP request to controller. Instead do it through the view file/program.

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