How to add #ancora at the end of the URL (with pagination codeigniter)

1

How do I add the anchor id at the end of the url?

At this moment my url is as follows: link

I needed it to be as follows: link

I have the following controller:

.
.
.

$ urlPaginacao = site_url ();

    //PAGINAÇÃO *****

    $get_total_results = $this->admin_model->mostrarAgenda();
    $totalResultados = $get_total_results['total'];
    $getPaginacao = $this->paginacao($urlPaginacao,$totalResultados, 3);

    $getEventos = $this->admin_model->mostrarAgenda($getPaginacao['inicio'], $getPaginacao['quantidadeResultados']);

    $data['district'] = $this->admin_model->mostrarDistrict();
    $data['local'] = $this->admin_model->mostrarLocal();
    $data['life'] = $this->admin_model->mostrarLife();
    $data['useful'] = $this->admin_model->mostrarUseful();
    $data['agenda'] = $getEventos['dadosGerais']; //dados gerais do model
    $data['pag'] = $getPaginacao['paginacao'];




    $this->load->view('index', $data);

}

public function paginacao($urlPaginacao, $totalResultados, $resultadosPorPagina = 3){

$config['base_url'] = $urlPaginacao;
$config['total_rows'] = $totalResultados;
$config['per_page'] = $resultadosPorPagina;
$config['page_query_string'] = TRUE;

$config['full_tag_open'] = "<ul class='pagination pagination-sm'>";
$config['full_tag_close'] ="</ul>";
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = "<li class='active disable'><a>";
$config['cur_tag_close'] = "</a></li>";
$config['next_tag_open'] = "<li>";
$config['next_tagl_close'] = "</li>";
$config['prev_tag_open'] = "<li>";
$config['prev_tagl_close'] = "</li>";
$config['first_tag_open'] = "<li>";
$config['first_tagl_close'] = "</li>";
$config['last_tag_open'] = "<li>";
$config['last_tagl_close'] = "</li>";

$config['first_link'] = TRUE;
$config['last_link'] = TRUE;

$quantidade = $resultadosPorPagina;
$this->pagination->initialize($config);

$data['quantidadeResultados'] = $quantidade;
$data['inicio'] = $this->input->get('per_page') != NULL ? $this->input->get('per_page') : '0';
$data['paginacao'] = $this->pagination->create_links();
return $data;

}

I have the following model:

public function mostrarAgenda($inicio=NULL, $quantidade=NULL){

    $inicio = $inicio != NULL ? "LIMIT {$inicio},{$quantidade}" : "";

    $sqlGeral = "SELECT * FROM tblagenda {$inicio}";

    $queryGeral = $this->db->query($sqlGeral);
    $data['inicio'] = $inicio;
    $data['total'] = $queryGeral->num_rows();
    $data['dadosGerais'] = $queryGeral->result();

    return $data;
}

I'm not able to insert the #agenda at the end of the url

Thank you

    
asked by anonymous 09.10.2015 / 13:35

1 answer

0

I found the solution that was right in front of my eyes,

In my controller in the pagnation function, in the pagination settings just add the following config:

$config['suffix'] = '#agenda';

DONE

Thank you

    
14.10.2015 / 11:16