Exemplo n.º 1
0
<?php

require "blog.php";
use Blog\DB;
// Fetch all posts
$post = DB\get_by_id((int) $_GET["id"], $conn);
if ($post) {
    $post = $post[0];
    view("single", array("post" => $post));
} else {
    header("location:/sandbox/blog");
}
Exemplo n.º 2
0
<?php

require 'blog.php';
use Blog\DB;
$post = DB\get_by_id((int) $_GET['id'], $conn);
if ($post) {
    $post = $post[0];
    view('single', array('post' => $post));
} else {
    header('Location: index.php');
}
// $view_path = 'views/single.view.php';
// include 'views/layout.php';
Exemplo n.º 3
0
<?php

require 'blog.php';
use Blog\DB;
$post = DB\get_by_id($_GET['id'], $conn);
if (!$post) {
    header('location:/blog');
}
$data = ['post' => $post];
view('single', $data);