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 |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/App/Controllers/products.php b/src/App/Controllers/products.php
index 9f7cac1..95ab1d5 100644
--- a/src/App/Controllers/products.php
+++ b/src/App/Controllers/products.php
@@ -1,15 +1,27 @@
 <?php
 namespace App\Controllers;
+use App\Models\Product;
+use Framework\Viewer;
 class Products {
     public function index() {
 
-        $model = new \App\Models\Product;
+        $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() {
-        require "views/products_show.php";
+    public function show(string $id) {
+        $viewer = new Viewer;
+        echo $viewer->render("Products/show.php", [
+            "id"=> $id
+        ]);
+    }
+
+    public function showPage(string $title, string $id, string $page) {
+        echo $title, " ", $id, " ", $page;
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0