/** * Generates a page * * @param $page_id * * @param int $max_entities * * @return array */ public function GeneratePage($page_id, $max_entities = 5, $tags = null) { /** * Return array */ $return = array(); /** * Lets first work out our splits */ $pointer = 0 + $page_id * $max_entities; /** * We first need to check if we are using tags or not */ if ($tags == null) { /** * Lets get all our posts */ $posts = $this->database->SelectAll(); /** * Lets then splice our array */ $cut_array = array_splice($posts, $pointer); /** * Then, we have to splice again */ array_splice($cut_array, $max_entities); /** * Then return */ return $cut_array; } }
/** * What we do on construct * * @param $post_id */ public function __construct($post_id) { $this->database = DatabasePosts(); /** * If this exists */ if ($this->database->Exists($post_id)) { $this->post_data = $this->database->Select($post_id); } else { /** * Return false if not */ return false; } /** * Return true; */ return true; }