I have a question with route a query string.
I'm trying to route with codeigniter a search. I have some parameters for each search, first a input text field, for a title or a description. Second, I have categories like, Utilities, Games, Exercise... Third, a platform, like, IOS, WP, Android.. and also the page.
I would like to see the route like:
/page/3, or
/page/3/search/whatever or
/cat/Games or
/cat/Games/search/battelfield or
/page/1/cat/games/search/battelfield or
/search/whatever or something like that.
I am using this code for the function in the model:
enter code here
function getAppBy($categ, $page, $str, $platform) {
$perpage = 16;
$offset = ($page-1)*$perpage;
$this->db->select('app.id');
$this->db->from('t_yp_app_category cat, t_yp_user_apps app');
if ($categ != "") {
$this->db->where("cat.name =", $categ);
} if ($str != "") {
$this->db->like('app.yp_title', '%' . $str . '%');
$this->db->like('app.yp_description', '%' . $str . '%');
}if ($platform != "") {
$this->db->like('app.yp_platforms', '%' . $platform . '%');
}
$this->db->limit($perpage,$offset);
$query = $this->db->get();
$result = $query->result_array();
//FIN SELECT
if (sizeof($result) > 0) {
return $result;
} else {
return false;
}
}
enter code here
Thank you. If I havent explained well, let me know