Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <div class="latestNewsHolder">
  2. <?php
  3. $getLatest = $dbw->prepare('SELECT * FROM cms_news WHERE published = "1" ORDER BY id DESC LIMIT 3')->execute();
  4.  
  5. $latestTitle = "";
  6. $latestImage = "ts_generic_23.gif";
  7. $latestLink = "#";
  8.  
  9. if($getLatest->rowCount() < 1)
  10. {
  11. // Nothing shows
  12. }
  13. else
  14. {
  15. $news = $getLatest->fetchAll();
  16.  
  17. foreach($news as $n):
  18. $latestImage = $n['image'];
  19. $latestTitle = $n['title'];
  20. $latestLink = "/news.php?aid=".$n['id'];
  21. ?>
  22. <div class="newsSeparator col-4">
  23. <div class="newsImage" style="background: url('/tpl/assets/topstory/<?php echo $latestImage; ?>') center no-repeat; background-size:cover;">
  24. <div class="latestNewsTitle">
  25. <a href="<?php echo $latestLink; ?>"><?php echo $latestTitle; ?></a>
  26. </div>
  27. </div>
  28. </div>
  29. <?php
  30. endforeach;
  31. }
  32. ?>
  33. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement