Advertisement
Guest User

Untitled

a guest
May 29th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. NEWS INDEX
  2. ==========
  3. <h2>News Index</h2>
  4.  
  5. <a href="<?php echo APP_ROOT;?>news/create">Add News</a>
  6.  
  7. <?php
  8. foreach($this -> data as $news) {
  9. var_dump($news);
  10. echo '<div'.$news['title'].'</div';
  11. echo '<div'.$news['content'].'</div';
  12. }
  13.  
  14. NEWS CONTROLLER
  15. ===============
  16. //Ausgabe im View
  17. public function view()
  18. {
  19. $this -> view -> data = $this -> view -> model -> showNews();
  20. $this -> view -> render('news/index');
  21.  
  22. }
  23.  
  24. NEWS MODEL
  25. =========
  26. public function showNews()
  27. {
  28. $res = $this -> db -> query("SELECT * FROM news");
  29. return $res -> fetch_all(MYSQL_ASSOC);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement