Navigation
<li<?php if ($pageid == $nav['id']){echo ' class="active"';}?>><a
href="<?php echo $nav['id']; ?>"><?php echo $nav['LEBEL']; ?></a></li>
<?php
// Setup File:
# Database connection here ...
$dbc = mysqli_connect('localhost', 'Amos', '251349','Myweb') OR die('Could not
connect because: '.mysqli_connect_error());
# Constants:
DEFINE('D_TEMPLATE', 'template');
# Functions:
include('functions/[Link]');
include('functions/[Link]');
$site_title = 'MALCOLM MOFFAT COLLEGE OF EDUCATION';
if (isset($_GET ['page'])) {
$pageid = $_GET ['page']; // set $pageid to equal the value given in the
URL
} else {
$pageid = 1; // set $pageid equal to 1 or the home page.
# Page Setup
$page = data_page($dbc, $pageid);
?>
[Link]
<?php
include ('config/[Link]'); ?>
$q = "SELECT * FROM pages WHERE Id = 1" ;
$r = mysqli_query($dbc, $q);
$page = mysqli_fetch_assoc($r);
echo $page['title']
<!DOCTYPE html>
<html>
<head>
<title> <?php echo $page['title']. ' | '. $site_title ?> </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include ('config/[Link]');?>
<?php include ('config/[Link]');?>
</head>
<body>
<div id="wrap">
<?php include(D_TEMPLATE.'/[Link]'); // main navigation ?>
<div class="container">
<h1><?php echo $page['header']; ?></h1>
<p><?php echo $page['Body']; ?></p>
</div>
</div><!-- END wrap -->
<?php include (D_TEMPLATE.'/[Link]'); //page footer ?>
</body>
[Link]
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<ul class="nav navbar-nav">
<?php nav_main($dbc, $pageid); ?>
<li><a href="#">Faq</a></li>
<li><a href="#">Log IN</a></li>
</ul>
</div>
</nav><!-- End nav -->
[Link]
<footer id="footer">
<div class="container">
<center> <p>MALCOLM MOFFAT COLLEGE OF EDUCATION.</p> </center>
<center> <p> Copyright © 2018 Mj & SHEM Arts</p> </center>
</div>
</footer><!-- END footer -->
[Link]
<?php
function nav_main($dbc, $pageid) {
$q = "SELECT * FROM pages";
$r = mysqli_query($dbc, $q);
while($nav = mysqli_fetch_assoc($r)){ ?>
<li<?php if($pageid == $nav['id']) {echo 'class="active"';}?>><a
href="?page=<?php echo $nav['id']; ?>"><?php echo $nav['LEBEL']; ?></a></li>
<?php }
}
?>