From bf18c77ec2b3dc1ffdda922e6065108ca5c126eb Mon Sep 17 00:00:00 2001 From: filippo.bertilotti <filippobertilotti@gmail.com> Date: Mon, 13 May 2024 11:32:36 +0200 Subject: [PATCH] fixing render using output buffering (parte 76) --- src/App/Controllers/products.php | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/App/Controllers/products.php b/src/App/Controllers/products.php index 68c4516..4e76a58 100644 --- a/src/App/Controllers/products.php +++ b/src/App/Controllers/products.php @@ -1,16 +1,25 @@ <?php namespace App\Controllers; +use App\Models\Product; +use Framework\Viewer; class Products { public function index() { - require "src/models/product.php"; - + $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() { + public function show(string $id) { + var_dump($id); require "views/products_show.php"; } + + public function showPage(string $title, string $id, string $page) { + echo $title, " ", $id, " ", $page; + } } \ No newline at end of file -- Gitblit v1.8.0