refactor: ♻️ refactor out post-type specific code

This commit is contained in:
David Bailey 2023-12-13 10:19:00 +01:00
parent 9e855fba36
commit 38a5056ff0
3 changed files with 129 additions and 139 deletions

View file

@ -1,11 +1,11 @@
<?php
require_once 'vendor/autoload.php';
require_once 'mysql_adapter.php';
require_once 'post_adapter.php';
// $sql = mysqli_connect('mysql', 'root', 'example', 'dragon_fire');
$adapter = new MySQLAdapter();
$adapter = new PostHandler();
//if (!$sql)
// {
@ -77,7 +77,7 @@ if($SURI == '/') {
"subposts" => $post['subposts']
]);
}
elseif($post['post_metadata']['type'] == 'file') {
elseif($post['post_metadata']['type'] == 'image') {
echo $twig->render('post_types/image.html', [
"post" => $post
]);