<?php $this->load->view('templates_admin/_header'); ?>

<?php $this->load->view('templates_admin/_sidebar'); ?>

<div class="col-md-8">

<section class="panel panel-default">
	<div class="panel-body">

<?php

echo '<h1>Posts '.anchor(base_url().'admin/post_edit/', 'New post').'</h1>';

if (count($posts) > 0) {
	foreach ($posts as $post) {
		echo '<h3>'.anchor(base_url().'posts/view/'.$post['id'], $post['title']).'</h3>';
		echo '<div>'.anchor(base_url().'admin/post_edit/'.$post['id'], '[edit]').'</div>';
		echo '<div>'.$post['content'].'</div>';
	}
} else {
	echo '<div class="alert alert-warning">No posts to display.</div>';
}

?>

	</div>
</section>

</div>

<?php $this->load->view('templates_admin/_footer'); ?>