Thirupathi
Joined: 01 Dec 2009 Posts: 116
|
Posted: Wed Feb 03, 2010 11:03 am Post subject: Example program using CodeIgniter |
|
|
CodeIgniter Sample Application:
------------------------------------
Hi Friends,I have posted one example program by using CodeIgniter Frame work.It may be useful to the people who are new to work with CodeIgniter.
testcontroller.php--->place this program in controllers folder
<?php
class TestController extends Controller{
function TestController(){
parent::Controller(); //This is the constructor
}
function index(){
$this->load->model('testmodel','test'); //We can load the required model in to our controller
$data = $this->test->getData(); //Calling the getData() method in testmodel
$this->load->view('testview',$data);//Load the required view with our data
}
}
?>
testmodel.php -->place this program in to models folder
<?php
class TestModel extends Model{
function TestModel(){
parent::Model();
}
function getData(){
$data['title'] = "This is the testing program";
$data['companyname'] = "Nyros Technologies";
$data['location'] = "Kakinada-STPI";
}
}
?>
testview.php -->place this program in to views folder
<html>
<titile><?=$title?></title>
<head></head>
<body>
Company Name:<?php echo $companyname;?>
Location:<?php echo $location;?>
</body>
</html>
Thanks & Regards,
Thirupathi.J |
|