Reputation: 59
I have a problem in extending native library in codeigniter.
CONTROLLER:
function search(){
$query_array = array(
'title' => $this->input->post('title'),
'category' => $this->input->post('category')
);
$query_id = $this->input->save_query($query_array); //extends to save_query
redirect("site/view_games/$query_id");
}
EXNTENDED LIBRARY:
<?php
if (!defined('BASEPATH')) exit('No direct access allowed.');
class MY_Input extends CI_Input{
function MY_Input(){
parent::CI_Input();
}
function save_query($query_array){
$CI =& get_instance();
$CI->db->insert('e_queries', array('query_string' => http_build_query($query_array)));
return $CI->db->insert_id();
}
?>
CONFIGURATIONS: my MY_Input.php in is the application/libraries/MY_Input.php
Where did I messed up? Huhuhuuh.
Upvotes: 3
Views: 2788
Reputation: 122
The CI_Input class is a core library . You will have to put your MY_Input.php file under application/core/
Upvotes: 8