Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5093b2e1c0
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (23 sloc) 0.581 kb
<?php
App::import('Vendor', 'simplehtmldom'.DS.'simple_html_dom');
class PostsController extends AppController {
function index() {
$this->set('posts', $this->Post->find('all'));
}
function view($id) {
$this->Post->id = $id;
$this->set('post', $this->Post->read());
}
function add() {
if (!empty($this->data)) {
if ($this->Post->save($this->data)) {
$this->flash('Your post has been saved.', '/posts');
}
}
}
function delete($id) {
$this->Post->del($id);
$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
}
}
?>
Jump to Line
Something went wrong with that request. Please try again.