listBlogPostView.php 796 Bytes
Newer Older
Corentin Bettiol's avatar
Corentin Bettiol committed
1 2 3 4 5 6 7
<?php
	if(!isset($admin)){
		header("Location:/patate");
		exit();
	}

	foreach ($blogposts as $post){
8
		$post['datetime'] = new DateTime($post['time']);		
9
		$exist = true;
Corentin Bettiol's avatar
Corentin Bettiol committed
10 11 12
		?>
		<article>
			<p class="listAdmin">
13
				<b><a href="/article/<?php echo $post['slug']; ?>"><?php echo $post['title'] ?></a></b> 
14
				<span class="postInfos"><?php echo date_format($post['datetime'], 'd/m/Y à H:i'); ?></span> <a class="button" href="/patate/blog/<?php echo $post['slug']; ?>/edit">📝</a> <a class="button" href="/patate/blog/<?php echo $post['slug'] ."/delete"; ?>" onclick="return confirm('C\'est certain ?')"></a>
Corentin Bettiol's avatar
Corentin Bettiol committed
15 16 17 18
			</p>
		</article>
		<?php
	}
19
	if(!isset($exist)){
Corentin Bettiol's avatar
Corentin Bettiol committed
20 21 22 23 24 25 26 27
		?>
		<article>
			<h4>Pas de post</h4>

			<p>Aucun billet n'a encore été publié, patience !</p>
		</article>
		<?php
	}