Codeigniter_Blog_App/application/views/templates/header.php

77 lines
3.5 KiB
PHP
Raw Normal View History

2024-07-11 04:23:32 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blog App</title>
<link rel="stylesheet" href="<?= base_url() ?>assets/css/bootstrap.min.css">
<link rel= "stylesheet" href = "<?= base_url() ?>assets/css/style.css">
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>
</head>
<body>
<nav class = "navbar navbar-inverse">
<div class = "container">
<div id = "nav-header" class = "navbar-header">
<a class = "navbar-brand" href="<?= base_url(); ?>">Blog App</a>
</div>
<div id = "navbar">
<ul class = "nav navbar-nav">
<li><a href = "<?= base_url(); ?>home">Home</a></li>
<li><a href = "<?= base_url(); ?>about">About</a></li>
<li><a href = "<?= base_url(); ?>posts">Blog</a></li>
<li><a href = "<?= base_url(); ?>categories">Categories</a></li>
</ul>
<ul class = "nav navbar-nav navbar-right">
<?php if(!$this->session->userdata('logged_in')) : ?>
<li><a href="<?php echo base_url(); ?>users/login">Login</a></li>
<li><a href="<?php echo base_url(); ?>users/register">Register</a></li>
<?php endif; ?>
<?php if($this->session->userdata('logged_in')) : ?>
<li><a href="<?php echo base_url(); ?>posts/create">Create Post</a></li>
<li><a href="<?php echo base_url(); ?>categories/create">Create Category</a></li>
<li><a href="<?php echo base_url(); ?>users/logout">Logout</a></li>
<?php endif; ?>
</ul>
</div>
</div>
</nav>
<div class = "layout" style ="margin-left: 10%; margin-right: 10%">
<!-- Flash Messages -->
<?php if($this->session->flashdata('user_registered')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('user_registered').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('post_created')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('post_created').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('post_updated')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('post_updated').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('category_registered')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('category_created').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('post_deleted')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('post_deleted').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('login_failed')): ?>
<?php echo '<p class="alert alert-danger">'.$this->session->flashdata('login_failed').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('user_loggedin')): ?>
<?php echo '<p class="alert alert-success">'.$this->session->flashdata('user_loggedin').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('user_loggedout')): ?>
<?php echo '<p class="alert alert-danger">'.$this->session->flashdata('user_loggedout').'</p>'; ?>
<?php endif; ?>
<?php if($this->session->flashdata('category_deleted')): ?>
<?php echo '<p class="alert alert-danger">'.$this->session->flashdata('category_deleted').'</p>'; ?>
<?php endif; ?>