Last active
November 22, 2015 03:50
-
-
Save ngurajeka/212a4e7d04d0043f2168 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once __DIR__.'/inc/Twig/lib/Twig/Autoloader.php'; | |
include_once __DIR__.'/inc/db.php'; | |
Twig_Autoloader::register(); | |
$loader = new Twig_Loader_Filesystem(__DIR__ . '/template'); | |
$twig = new Twig_Environment($loader, array()); | |
$data = array( | |
'judul' => 'Web Sederhana', | |
'deskripsi' => 'Belajar membuat web sederhana', | |
'list_blog' => [] | |
); | |
$list_blog = $db->query('SELECT * FROM `blog`'); | |
if ($list_blog) { | |
foreach ($list_blog as $i => $blog) { | |
$data['list_blog'][$i]['id'] = $blog['id']; | |
$data['list_blog'][$i]['title'] = $blog['title']; | |
$data['list_blog'][$i]['content'] = $blog['content']; | |
$data['list_blog'][$i]['date'] = $blog['date']; | |
} | |
} | |
echo $twig->render('gallery.html', $data); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment