From 2389d66da849798f8d4ec5f10e3b07c11da49185 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sat, 28 May 2011 13:28:16 -0400 Subject: Initial Commit --- controllers/SearchController.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 controllers/SearchController.php (limited to 'controllers/SearchController.php') diff --git a/controllers/SearchController.php b/controllers/SearchController.php new file mode 100644 index 0000000..fea8e41 --- /dev/null +++ b/controllers/SearchController.php @@ -0,0 +1,37 @@ +request->query['search'])) { + //Redirect them or something + } + + + $searchParam = '/' . $this->request->query['search'] . '/i'; + + $content; + $limit = 20; + $page = $this->request->page ?: 1; + $total; //<-- number of search results + + + switch($type) + { + case "anime": $content = Anime::find('all', array('conditions' => array('title' => array('like' => $searchParam)), $limit, $page)); + $total = Anime::count(array('title' => array('like' => $searchParam))); + break; + case "kdrama": break; + case "manga": break; + } + return compact('content', 'type', 'by', 'limit', 'total', 'page'); + } + + +} \ No newline at end of file -- cgit v1.2.3