[eluser]feri_soft[/eluser]
I have a default controller set to products.
and i have this code for pagination:
Code:
class Products extends Controller
{
function __construct()
{
parent::Controller();
}
function index()
{
$this->load->library('pagination');
$config['base_url'] = base_url(). 'products/';
$config['total_rows'] = $this->db->count_all('products');;
$config['per_page'] = '1';
$this->pagination->initialize($config);
$query = $this->db->get('products', $config['per_page'], $this->uri->segment(2));
$data['products'] = $query->result_array();
$data['pagination'] = $this->pagination->create_links();
$template['title'] = "asdasdasdasdasd";
$template['description'] = "asdasdasdasdasd";
$template['keywords'] = "asdasd, asdasd, asdasdasd, asdasd";
$template['left'] = $this->load->view('left', $data, true);
$template['content'] = $this->load->view('products', $data, true);
$this->load->view('container', $template);
}
....
And in routes i have the following:
Code:
$route['products/:num'] = "products/index";
Its not working at all i get 404 not found error. But when i remove the route and change the products to:
Code:
$config['base_url'] = base_url(). 'products/index/';
and
Code:
$this->uri->segment(2)
al is working fine.
Please tell me whats the problem. I have checked the user guide but nothing on this issue was posted. I have to find a solution on this. Thanks!