'/view/(int)story_id', 'comment' => '/comment/(int)story_id/(str)action', 'category' => '/category/(int)categor_id/(str)categoy_name', 'console' => '/console/(int)console_id/(str)console_name/(str)type', 'author' => '/author/(int)author_id/(str)author_name' ); public $default_action = 'console'; public function view(Request $request, Response $response) { $story = $this->getFinder('news')->find($request['story_id']); $response->story = $story; $response->page = 'story.html'; $response->title = $story->title; } public function comment(Request $request, Response $response) { $response->page = 'story.html'; if($response['action'] == 'submit') { } else { $this->view($request, $response); } } public function category(Request $request, Response $response) { $response->page = 'news.html'; $response['news'] = $this->getFinder('news')->findAllBy('category_id', $request['category_id']); } public function console(Request $request, Response $response) { $console_id = $request['console_id']; if($console_id === null) { $news = $this->getFinder('news')->findAll(null, 'created DESC'); } else { $news = $this->getFinder('news')->findAllBy('console_id', $console_id, 'created DESC'); } $response->news = $news; $response->page = 'news.html'; $response->title = ucfirst($news->console->name); } public function author(Request $request, Response $response) { $response->page = 'news.html'; $response['news'] = $this->getFinder('news')->findAllBy('author_id', $request['author_id']); } } ?>