<?php
    $array = glob("puzzle/*");
?>
<!DOCTYPE html>
<html>
  <head>
    <title>Leçon 9 - Exercice 4</title>
    <meta charset="utf-8" />
    <link type="text/css" rel="stylesheet" href="puzzle.css" />
  </head>

<body>
	
<h1>Leçon 9 - Exercice 4</h1>

<h2>Choisissez votre puzzle !</h2>

<?php
	foreach ( $array as $puzzle ) {
?>
	<div class="small">
		<a href="puzzle.php?puzzle=<?= basename($puzzle) ?>">
			<img src="<?= "$puzzle/image.jpeg" ?>" alt="Image" />
		</a>
		<h3><?= file_get_contents("$puzzle/title.txt") ?></h3>
	</div>	
	
<?php } ?>

</body>
</html>
