Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. include('configs/pdo.inc.php');
  4. include('libs/Smarty.class.php');
  5.  
  6. // create object
  7. $smarty = new Smarty;
  8.  
  9. // Nieuws ophalen
  10. try {
  11. $query = $oPDO->prepare("SELECT * FROM T_Nieuws ORDER BY D_id DESC LIMIT 5");
  12. $query->execute();
  13. $smarty->assign('nieuws', $query->fetchAll());
  14.  
  15. $t = array();
  16. foreach ($query as $row) {
  17. $t[$row['id']] = $row;
  18. }
  19.  
  20. $smarty->assign('content', $t);
  21. } catch (PDOException $e) {
  22. echo '<pre>';
  23. echo 'Regelnummer: ' . $e->getLine() . '<br>';
  24. echo 'Bestand: ' . $e->getFile() . '<br>';
  25. echo 'Foutmelding: ' . $e->getMessage() . '<br>';
  26. echo '</pre>';
  27. }
  28.  
  29. // display it
  30. $smarty->display('extends:layout.tpl|header.tpl|nieuws.tpl|footer.tpl');
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement