Post_Page.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Post.php");
  4. /**
  5. * Post page model.
  6. */
  7. class Post_Page extends Page{
  8. /**
  9. * The selected {@see Post}.
  10. */
  11. public $post;
  12. /**
  13. * Constructor.
  14. *
  15. * Retrieves the data and initializes the variables.
  16. *
  17. * @param db Connection to the database.
  18. * @param lang Lowercase, two-letter language code.
  19. * @param id Post id or permalink.
  20. */
  21. public function __construct($db, $lang, $id){
  22. global $path;
  23. global $base_url;
  24. global $static;
  25. global $data;
  26. parent:: __construct($db, $lang);
  27. $this->template = $path["template"] . "post.php";
  28. $this->post = new Post($this->db, $this->lang, $id);
  29. $this->title = $this->post->title . " - " . $data["name"];
  30. $this->description = $this->post->title . " - " . $data["name"];
  31. if (sizeof($this->post->image) > 0){
  32. $this->icon = $static["content"] . "blog/" . $this->post->image[0]->image;
  33. }
  34. else{
  35. $this->icon = $static["layout"] . "logo/logo.svg";
  36. }
  37. $this->canonical = $base_url . "/blog/" . $this->post->permalink . "/";
  38. }
  39. }
  40. ?>