From 06ecfbea905d7bc006dbe19243673209bb69c8f6 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sun, 5 Jun 2011 21:18:57 -0400 Subject: Implemented a proper anime controller --- controllers/AnimeController.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 controllers/AnimeController.php (limited to 'controllers/AnimeController.php') diff --git a/controllers/AnimeController.php b/controllers/AnimeController.php new file mode 100644 index 0000000..080a9c3 --- /dev/null +++ b/controllers/AnimeController.php @@ -0,0 +1,35 @@ +redirect("/anime"); + } + + //If the user search for a string + if (!is_numeric($id)) + { + $anime = Anime::search($id); + var_dump($anime); + if (count($anime) == 1) + { + return $anime; + } + + return $this->render(array('template' => '..search/index', 'data' => array('results' => $anime))); + /*//Pass it to search + return $this->redirect(array('controller' => 'search', 'action' => 'index', 'args' => array('anime'), 'query' => '' )) + */ + } + + $anime = Anime::find('first', array('conditions' => array('special_id' => $id))); + return $anime; + } +} \ No newline at end of file -- cgit v1.2.3