(1)Download codeigniter from "http://www.codeigniter.com/download"
(2) create folder ci under path "c:/wamp/www"
(3) then extract zip file of CodeIgniter-2.2.1 into "ci" folder.
(means into following path=
"C:/wamp/www/ci")
(4)then go to browser & type
"localhost/ci/" (note: you will see welcome message )
(5)now understand Codeigniter sturcture:
It contains three main folder under "application" folder:
(a)controllers (handles all incoming Http requests,passes data to the views).
(b)views(Renders the Html output).
(c)Models(Encapsulate Business Logic,such as Interaction with database).
(6)now opend notepad type following code:
<h1> this is header </h1>
save file name as header.php & save this file under "views" folder.
(7) type code:
<h1>this is content </h1>
save file name as content.php & save this file under "views" folder.
(8) type code:
h1> this is footer </h1>
save file name as footer.php & save this file under "views" folder.
(9) now wirte following code :
<?php
class Hello extends CI_controller
{
public function one()
{
echo "this is one";
}
public function two()
{
$this->load->view('header.php');
$this->load->view('content.php');
$this->load->view('footer.php');
}
}
save this file as hello.php & save this file under "controllers" folder.
(10) Now open browser & to run one function of hello class
type following url:"Localhost/index.php/hello/one
output: this is one
(11)Now open browser & to run two function of hello class
type following url:"Localhost/index.php/hello/two
output:
this is header
this is content
this is footer
(2) create folder ci under path "c:/wamp/www"
(3) then extract zip file of CodeIgniter-2.2.1 into "ci" folder.
(means into following path=
"C:/wamp/www/ci")
(4)then go to browser & type
"localhost/ci/" (note: you will see welcome message )
(5)now understand Codeigniter sturcture:
It contains three main folder under "application" folder:
(a)controllers (handles all incoming Http requests,passes data to the views).
(b)views(Renders the Html output).
(c)Models(Encapsulate Business Logic,such as Interaction with database).
(6)now opend notepad type following code:
<h1> this is header </h1>
save file name as header.php & save this file under "views" folder.
(7) type code:
<h1>this is content </h1>
save file name as content.php & save this file under "views" folder.
(8) type code:
h1> this is footer </h1>
save file name as footer.php & save this file under "views" folder.
(9) now wirte following code :
<?php
class Hello extends CI_controller
{
public function one()
{
echo "this is one";
}
public function two()
{
$this->load->view('header.php');
$this->load->view('content.php');
$this->load->view('footer.php');
}
}
save this file as hello.php & save this file under "controllers" folder.
(10) Now open browser & to run one function of hello class
type following url:"Localhost/index.php/hello/one
output: this is one
(11)Now open browser & to run two function of hello class
type following url:"Localhost/index.php/hello/two
output:
this is header
this is content
this is footer
No comments:
Post a Comment