| @@ 68-82 (lines=15) @@ | ||
| 65 | * |
|
| 66 | * @return void |
|
| 67 | */ |
|
| 68 | public function viewAction($slug = null) |
|
| 69 | {
|
|
| 70 | $blog = $this->blog->findWhere('slug', $slug);
|
|
| 71 | ||
| 72 | if (empty($blog)) {
|
|
| 73 | die('No such post!');
|
|
| 74 | } |
|
| 75 | ||
| 76 | $post = $blog[0]; |
|
| 77 | ||
| 78 | $this->theme->setTitle("View post with id");
|
|
| 79 | $this->views->add('blog/view-post', [
|
|
| 80 | 'post' => $post, |
|
| 81 | ]); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * Add new blogpost. |
|
| @@ 63-77 (lines=15) @@ | ||
| 60 | * |
|
| 61 | * @return void |
|
| 62 | */ |
|
| 63 | public function viewAction($slug = null) |
|
| 64 | {
|
|
| 65 | $pages = $this->page->findWhere('slug', $slug);
|
|
| 66 | ||
| 67 | if (empty($pages)) {
|
|
| 68 | die('No such page!');
|
|
| 69 | } |
|
| 70 | ||
| 71 | $page = $pages[0]; |
|
| 72 | ||
| 73 | $this->theme->setTitle($page->title); |
|
| 74 | $this->views->add('page/view', [
|
|
| 75 | 'page' => $page, |
|
| 76 | ]); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Add new page. |
|