You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
|
|
|
require 'lib/database.php';
|
|
require 'lib/project.php';
|
|
|
|
$limit = 5;
|
|
|
|
$numberOfPages = getProjectNumberOfPages($limit);
|
|
|
|
if (isset($_GET['page'])) {
|
|
$page = (int) $_GET['page'];
|
|
} else {
|
|
$page = 1;
|
|
}
|
|
|
|
if ($page > $numberOfPages) {
|
|
$page = 1;
|
|
}
|
|
|
|
$projects = getProjects($page, $limit);
|
|
$pager = getProjectsPager($page, $numberOfPages);
|
|
|
|
?>
|
|
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<link rel="stylesheet" href="style.css" />
|
|
<title>
|
|
Mon super portfolio
|
|
</title>
|
|
</head>
|
|
<body>
|
|
<h1>Mon super portfolio</h1>
|
|
|
|
<?php if (count($pager) > 1): ?>
|
|
<ul class="pager">
|
|
<?php foreach ($pager as $p): ?>
|
|
<li <?php if ($p['current'] === true): ?>class="active"<?php endif ?>>
|
|
<a href="?page=<?php echo $p['page'] ?>">
|
|
<?php echo $p['title'] ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach ?>
|
|
</ul>
|
|
<?php endif ?>
|
|
|
|
<section>
|
|
<?php foreach($projects as $project): ?>
|
|
<article>
|
|
<h2><?php echo $project['title'] ?></h2>
|
|
|
|
<figure>
|
|
<img src="images/<?php echo $project['illustration'] ?>" alt="" width="130px" />
|
|
</figure>
|
|
|
|
<p class="description">
|
|
<?php echo $project['description'] ?>
|
|
</p>
|
|
|
|
<?php $date = new DateTime($project['date']); ?>
|
|
|
|
<p>
|
|
<a href="project.php?id=<?php echo $project['id'] ?>">En savoir plus</a>
|
|
</p>
|
|
|
|
<p class="date">
|
|
<time datetime="<?php echo $date->format(DateTime::W3C) ?>">
|
|
<?php echo $date->format('d/m/Y') ?>
|
|
</time>
|
|
</p>
|
|
</article>
|
|
<?php endforeach ?>
|
|
</section>
|
|
|
|
<?php if (count($pager) > 1): ?>
|
|
<ul class="pager">
|
|
<?php foreach ($pager as $p): ?>
|
|
<li <?php if ($p['current'] === true): ?>class="active"<?php endif ?>>
|
|
<a href="?page=<?php echo $p['page'] ?>">
|
|
<?php echo $p['title'] ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach ?>
|
|
</ul>
|
|
<?php endif ?>
|
|
</body>
|
|
</html>
|