public function action_view($id = null) { is_null($id) and Response::redirect('Messages'); if (!($message = Model_Message::find($id))) { Session::set_flash('error', 'Could not find message #' . $id); Response::redirect('Messages'); } $comments = Model_Comment::query()->where('message_id', $id)->get(); $data = array('message' => $message, 'comments' => $comments); $this->template->title = 'Message'; $this->template->content = View::forge('messages/view', $data); }
public function action_Adetail($Pid = 0) { //トークンの生成 $this->data['token_key'] = Config::get('security.csrf_token_key'); $this->data['token'] = Security::fetch_token(); //投稿内容取得 $this->data['posts'] = Model_Post::query()->where('Pid', '=', $Pid)->get(); $is_record = count($this->data['posts']); //投稿IDが存在し、そのレコードが取得されているか if ($is_record) { $this->data['comments'] = Model_Comment::query()->where('Pid', '=', $Pid)->get(); $this->action_categorize(); $view = View::forge('post/PostsDetail_2', $this->data); $view->set_global('error', $this->error, false); return $view; } else { Response::redirect('_404_'); } }