Less home code more F3
This commit is contained in:
@@ -7,8 +7,8 @@ class SiteController extends BaseController
|
||||
public function home(): void
|
||||
{
|
||||
$page = max(1, (int) ($this->f3->get('GET.page') ?? 1));
|
||||
$media = new Media($this->db);
|
||||
$result = (new Post($this->db))->paginateList($page, 12, $media);
|
||||
$media = new Media();
|
||||
$result = (new Post())->paginateList($page, 12, $media);
|
||||
|
||||
$this->render('site/home.html', [
|
||||
'pageTitle' => 'Accueil',
|
||||
@@ -20,8 +20,8 @@ class SiteController extends BaseController
|
||||
|
||||
public function show(): void
|
||||
{
|
||||
$media = new Media($this->db);
|
||||
$post = (new Post($this->db))->findBySlug((string) $this->f3->get('PARAMS.slug'), $media);
|
||||
$media = new Media();
|
||||
$post = (new Post())->findBySlug((string) $this->f3->get('PARAMS.slug'), $media);
|
||||
if ($post === null) {
|
||||
$this->f3->error(404, 'Article introuvable.');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user