Pagination in codeigniter 3

Asked

Viewed 776 times

0

Guys I made the pagination in codeigniter and it works with the exception of a detail the link of page two is url/1, page three is url/2 and the first only url. What do I do to leave page two with/2 url? Follow the code:

$config = array();
    $config["base_url"] = base_url() . "usuarios";
    $config["total_rows"] = $this->usuario->totalRegistros();
    $config["per_page"] = $this->config->item('registros_por_pagina');
    $config["uri_segment"] = 2;
    $this->pagination->initialize($config);

    $pagina = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;

    $data['usuarios'] = $this->usuario->listarUsuarios($config["per_page"], $pagina);
    $data["paginacao"] = $this->pagination->create_links();

Thank you

1 answer

0

$config ['use_page_numbers'] = TRUE;

Put this in your code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.