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 | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/App/Controllers/products.php b/src/App/Controllers/products.php index db7d554..4e76a58 100644 --- a/src/App/Controllers/products.php +++ b/src/App/Controllers/products.php @@ -1,17 +1,25 @@ <?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"; } + + public function showPage(string $title, string $id, string $page) { + echo $title, " ", $id, " ", $page; + } } \ No newline at end of file -- Gitblit v1.8.0