hello friends, here you can find source code for, how to create simple hello world application in codeigniter
first download source for codeigniter from here Download Codeigniter extract zip file in www folder rename default name with your project name.
change your configuration in config file application/config.php config.php file
$config['base_url'] = '';
to
$config['base_url'] = 'http://localhost/codeigniter/'; //change your project configuration here.
create controller first.php in controller folder. Copy and Past below code in that file
controller/first.php
Create view first.php in view folder. Copy and Past below code in that file.
view/first.php
Now open your browser and go through below link.
http://localhost/codeigniter/index.php/first
- codeigniter is your project name .
- need to add index.php in url. It is also possible to remove index.php from url creating .htaccess file in project root folder using url routing.
- first is your controller name.
- Now you done you can see the output on browser. Thank you for visiting my blog.

first download source for codeigniter from here Download Codeigniter extract zip file in www folder rename default name with your project name.
change your configuration in config file application/config.php config.php file
$config['base_url'] = '';
to
$config['base_url'] = 'http://localhost/codeigniter/'; //change your project configuration here.
create controller first.php in controller folder. Copy and Past below code in that file
controller/first.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class First extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('first'); //load view file first.php no need for extention .php it added by default
}
}
?>
class First extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('first'); //load view file first.php no need for extention .php it added by default
}
}
?>
Create view first.php in view folder. Copy and Past below code in that file.
view/first.php
<html>
<head><title>First Example</title></head>
<style type="text/css">
.design{ background: #CCCCCC;width: 20%;text-align: center;margin-left: 40%; }
</style>
<body>
<div class="design"><h1>Hello World.!<Br>Welcome Done...!!!</h1></div>
</body>
</html>
<head><title>First Example</title></head>
<style type="text/css">
.design{ background: #CCCCCC;width: 20%;text-align: center;margin-left: 40%; }
</style>
<body>
<div class="design"><h1>Hello World.!<Br>Welcome Done...!!!</h1></div>
</body>
</html>
http://localhost/codeigniter/index.php/first
- codeigniter is your project name .
- need to add index.php in url. It is also possible to remove index.php from url creating .htaccess file in project root folder using url routing.
- first is your controller name.
- Now you done you can see the output on browser. Thank you for visiting my blog.

No comments:
Post a Comment