Skip to content

Instantly share code, notes, and snippets.

@zofe
Created May 28, 2013 08:21
Show Gist options
  • Save zofe/5661280 to your computer and use it in GitHub Desktop.
Save zofe/5661280 to your computer and use it in GitHub Desktop.
old style autocompleter
$acvetrina = new autocompleter_field(array('name'=>'acvetrina','status'=>'modify'));
$acvetrina->ajax_source = site_url('admin/feedback/js_vetrine');
$acvetrina->min_chars = '2';
$acvetrina->record_label = 'vetrina';
$acvetrina->record_id = 'ID';
$acvetrina->hidden_field_id = 'id_vetrina';
$acvetrina->extra_params = "category: function() { return $('#id_categoria').val() } , prov: function() { return $('#id_provincia').val() }";
$acvetrina->build();
function js_vetrine()
{
$this->db->select(....);
$this->db->from(....);
if (isset($_GET, $_GET['q']))
{
if ($_GET['q'] == '***')
{
//non vincolo al like
} else {
$this->db->like("va.`NOME`", $_GET['q']);
}
}
$this->db->limit(10);
$query = $this->db->get();
echo json_encode($query->result_array());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment