[eluser]Mutsop[/eluser]
Hi before I continue here is my code
Code:
function index($offset = 0){
if (!$this->ion_auth->logged_in())
{
//redirect them to the login page
redirect('administrator/login', 'refresh');
}
else
{
// offset
$uri_segment = 3;
$offset = $this->uri->segment($uri_segment);
// load data
$rubriek = $this->input->post('rubriek');
$data['action'] = site_url('admin/nieuws/'.$rubriek);
$nieuwsAll = $this->nieuws_model->get_paged_list($this->limit, $offset, $rubriek)->result();
// generate pagination
$this->load->library('pagination');
$config['base_url'] = site_url('admin/nieuws/'.$rubriek);
$config['total_rows'] = $this->nieuws_model->count_all();
$config['per_page'] = $this->limit;
$config['uri_segment'] = $uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
// generate table data
$this->load->library('table');
$tmpl = array ( 'table_open' => '<table border="0" cellpadding="10" cellspacing="0" class="table_main">' );
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_heading('Datum', 'Rubriek', 'Titel', 'Acties');
foreach ($nieuwsAll as $nieuws){
$this->table->add_row(date('d-m-Y',strtotime($nieuws->datum)), $nieuws->rubriek, $nieuws->titel,
anchor('admin/nieuws/view/'.$nieuws->id,'view',array('class'=>'view')).' '.
anchor('admin/nieuws/update/'.$nieuws->id,'update',array('class'=>'update')).' '.
anchor('admin/nieuws/delete/'.$nieuws->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Bent u er zeker van dit nieuws te verwijderen?')"))
);
}
$data['table'] = $this->table->generate();
// load view
$this->load->view('admin/header');
$this->load->view('admin/nieuwsLijst', $data);
$this->load->view('admin/footer');
}
}
Now, As I mentioned in a previous post, I have a combobox which should filter my table (not set in a different order, but simple filter out).
Now here is my model:
Code:
function get_paged_list($limit = 10, $offset = 0, $rubriek){
if(!$rubriek == ""){
$this->db->where('rubriek', $rubriek);
}
$this->db->order_by('datum','asc');
return $this->db->get($this->tbl_nieuws, $limit, $offset);
}
No when i submit my filter, i get following url for example:
"/admin/nieuws?rubriek=ateam"
I dont mind it being ?rubriek=something.... But it does give me an "404 Page Not Found".
Any ideas why?
I'm using the same index function for two reasons, else I have to remake a whole new table and wont be able to refactor much, and second, it is to learn
Regards