From 8fdeaaff9e2e6862cb3c9825522b51453a0340f6 Mon Sep 17 00:00:00 2001 From: filippo.bertilotti <filippobertilotti@gmail.com> Date: Mon, 13 May 2024 11:55:19 +0200 Subject: [PATCH] riorganizzazione views e refactor code per utilizzo nuova classe viewer (parte 77) --- src/App/Controllers/products.php | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/App/Controllers/products.php b/src/App/Controllers/products.php index 4b124f5..95ab1d5 100644 --- a/src/App/Controllers/products.php +++ b/src/App/Controllers/products.php @@ -1,18 +1,24 @@ <?php namespace App\Controllers; use App\Models\Product; +use Framework\Viewer; class Products { public function index() { $model = new Product; $products = $model->getData(); - require "views/products_index.php"; + $viewer = new Viewer; + echo $viewer->render("products_index.php", [ + "products"=> $products + ]); } public function show(string $id) { - var_dump($id); - require "views/products_show.php"; + $viewer = new Viewer; + echo $viewer->render("Products/show.php", [ + "id"=> $id + ]); } public function showPage(string $title, string $id, string $page) { -- Gitblit v1.8.0