*/ public function editEntry($id, $title, $text) { return $this->update(array("id" => (int) $id), array('$set' => array("title" => $title, "text" => $text, "editDate" => $this->date()))); } /** * Delete entry * @param int $id * @return boolean */ public function deleteEntry($id) { return $this->remove(array("id" => (int) $id)); } } $blog = new blog(); $blog->addEntry("Cheeseburgers", "This entry is full of winning."); // get all blog entries $entries = $blog->getAll(); foreach ($entries as $entry) { echo '<h2>' . $entry['title'] . '</h2>'; echo '<p>' . $entry['text'] . '</p>'; } // get the first ten entries $ten = $blog->find(); $ten->sort(array("id" => -1)); $ten->limit(10); foreach ($entries as $entry) { echo '<h2>' . $entry['title'] . '</h2>'; echo '<p>' . $entry['text'] . '</p>'; }