Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cms/index.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (31 sloc)
1.34 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php include("includes/header.php"); | |
if(isset($_GET['catagory'])) { | |
$category = mysqli_real_escape_string($db , $_GET['catagory']); | |
$query = "SELECT * FROM posts WHERE category='$category'"; | |
}else { | |
$query = "SELECT * FROM posts"; | |
} | |
$posts = $db->query($query); | |
?> | |
<?php error_reporting(E_ALL); | |
ini_set('display_errors', 1);?> | |
<div class="blog-header"> | |
<h1 class="blog-title">BlogCMS</h1> | |
<p class="lead blog-description">The official example template of creating a blog with Bootstrap.</p> | |
</div> | |
<?php if($posts->num_rows > 0) { | |
while($row = $posts->fetch_assoc()) { | |
?> | |
<div class="blog-post"> | |
<h2 class="blog-post-title"><a href="single.php?post=<?php echo $row['id'] ?>"><?php echo $row['title']; ?></a></h2> | |
<p class="blog-post-meta"><?php echo $row['date']; ?> by <a href="#"><?php echo $row['author']; ?></a></p> | |
<?php $body = $row['body']; | |
echo substr($body , 0 , 400) . "..."; | |
?> | |
<br> | |
<a href="<?php echo $row['id'] ?>" class="btn btn-primary">Read More</a> | |
</div><!-- /.blog-post --> | |
<?php } } ?> | |
</div><!-- /.blog-main --> | |
<?php include("includes/sidebar.php");?> | |
<?php include("includes/footer.php");?> | |