Basic Site creation in CodeIgniter
Here, we'll figure out how to make an essential site with the assistance of CodeIgniter.
In controllers envelope we'll make a record named as Form.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Form extends CI_Controller {
public function index()
{
$this->load->view('header');
$this->load->view('nav');
$this->load->view('content');
$this->load->view('footer');
}
}
?>
We have made various records for header, nav, substance and footer and every one of these documents are stacked in the contoller's record.
Record header.php in application/sees
<!DOCTYPE html>
<html>
<head>
<title>Basic Site</title>
<style type="text/css">
body, html{margin:0; padding:0;}
body{
background-color:#eee;
}
h1, h2, h3, h4, p, a, li, ul{
font-family: arial, sans-serif;
color: black;
text-decoration: none;
}
#nav{
margin: 50px auto 0 auto;
width: 10000px;
background-color: #888;
height: 15px;
padding: 20px;
}
#nav a:hover{
color: red;
}
#nav ul{
list-style: none;
float: left;
margin: 0 50px;
}
#nav ul li{
display: inline;
}
#content{
width: 1000px;
min-height: 100%;
margin: 0 auto;
padding: 20px;
}
#footer{
width: 400px;
height: 15px;
margin: 0 auto;
padding: 20px;
}
#footer p{
color: #777;
}
</style>
</head>
Document nav.php in application/sees
<body>
<div id="container">
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Career</a></li>
</ul>
</div>
Document content.php in application/sees
<div id="content">
<h1>Welcome to my site</h1>
<p>CodeIgniter is PHP driven framework but it's not a PHP substitute.
Diving into CodeIgniter doesn?t mean you are leaving PHP behind.
PHP is a server-side scripting language for building dynamic web-based applications.</p>
</div>
Document footer.php in application/sees
<div id="footer">
<p>Copyright (c) 2016 ABWorld.com All Rights Reserved</p>
</div>
</div>
</body>
</html>
Last yield is appeared underneath with URL localhost/site_example/index.php/Form.
Codeigniter Basic site creation in codeignter 7