From aa60edbbf09aa33d91787332055734ec874a8536 Mon Sep 17 00:00:00 2001 From: Gregorio Chiko Putra Date: Mon, 4 Sep 2017 15:35:11 +0700 Subject: [PATCH] Create function to pass data to html through twig --- App/Controllers/Posts.php | 12 +++++++++++- App/Views/Data/edit_pengumuman.html | 28 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/App/Controllers/Posts.php b/App/Controllers/Posts.php index 11621d3..e1c22aa 100644 --- a/App/Controllers/Posts.php +++ b/App/Controllers/Posts.php @@ -23,7 +23,17 @@ class Posts { if ($id) { // echo "You can edit exists data with id $id here"; // Nanti di replace sama twig view ke App\Views\Data\edit_pengumuman.html - View::render('Data/edit_pengumuman.html'); + View::render( + 'Data/edit_pengumuman.html', + [ + 'category' => 4, + 'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', + 'created_at' => '2017-05-10 10:00', + 'creator' => '5', + 'edited_at' => '2017-08-10 10:00', + 'editor' => '8' + ] + ); return true; } return false; diff --git a/App/Views/Data/edit_pengumuman.html b/App/Views/Data/edit_pengumuman.html index 08e64ef..9a6d89f 100644 --- a/App/Views/Data/edit_pengumuman.html +++ b/App/Views/Data/edit_pengumuman.html @@ -6,38 +6,38 @@

Pengumuman 1

- - + + + +
- +
- - + +
- - + +
- - + +
- +