[wd_asp elements=’search’ ratio=’100%’ id=1]

Codeigniter first script

19th November 2014

Random Coding

random coding category codehaven

Basic usage

Unzip Codeigniter 2.20 into a folder called ‘Codeigniter’

1. You need a controller (application/controller/pages.php)


load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
}

2. You need a view method (application/views/pages/home.php)


Hello World

3. and maybe a header (application/views/templatesfooter.php)



<?php echo $title ?> - Codehavens CodeIgniter Basics

CodeIgniter Basics

4. and footer (application/views/templates/footer.php)

© 2014


5. Run the url in your browser
http://localhost/Codeigniter/index.php/pages/view/home
(without a .php extension)
You should then be able to see an output that has a title(name of page), header and content of home.php, with a footer.