Welcome Guest, Not a member yet? Register   Sign In
Problem with $anchor_class with Pagination class

Hello, this is my first web project, so my first CI project and my first post in this forums. Also I'm not english speaker, excuse my bad english (and my bad coding :redSmile.

I'm using CI 2.03

I have a problem using the pagination class. When i use it without adding a class all works as expected, links render correctly and show the next results in my table. When I try to use:

$config['anchor_class'] = 'paginacio';

in order to use ajax to reload only the result table using ajax (getting html) pagination links don't get rendered correctly, i get this:

<a paginaciohref="">&gt;</a>&nbsp;&nbsp;

Seen this i tried to modify Pagination.php in this way:

var $query_string_segment = 'per_page';
var $display_pages  = TRUE;
var $anchor_class  = 'paginacio';

I get the correct class added to my links and first results and pagination links render correctly, BUT once i jump to other page (2, 3...) and i click again on the first page link (1) i see correctly the 1rst results but pagination links render the 2 page as current page and keep rendering the &lt; link. The original code:

function missatgeria($prim_param = '', $seg_param = ''){
  $dades['ruta'] = RUTA;
  $dades['menu'] = $this-&gt;menu_lateral();
  $usuari = $this->session->userdata('id_usuari');
   $this->output->set_header("Cache-Control: private, no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
   $this->output->set_header("Pragma: no-cache");
   $config['per_page'] = RES_PAGINA;
   $config['base_url'] = RUTA.'/missatgeria/';
   $segment = $this->uri->segment(3);
   if((!is_numeric($prim_param))&&($prim_param != NULL)){
    $seccio = $prim_param;
    $config['base_url'] = $config['base_url'].$prim_param;
    $config['total_rows'] = $this->Model_bancdetemps->llistat_missatges($usuari, $seccio)->num_rows();
    if($seg_param != ''){
     $config['uri_segment']= 4;
     $segment = $this->uri->segment(4);
    else $segment = '';
    $seccio = "entrada";
    $config['total_rows'] = $this->Model_bancdetemps->llistat_missatges($usuari, $seccio)->num_rows();
   $dades['bustia'] = $seccio;
   $dades['missatges'] = $this->Model_bancdetemps->llistat_missatges($usuari, $seccio, $config['per_page'],$segment);
   $config['full_tag_open'] = '<p>';
   $config['full_tag_close'] = '</p>';
   $dades['cos'] = $this->load->view('vista_missatges',$dades, TRUE);
  else $dades['cos'] = "Inicia sessiĆ³ per accedir a la missatgeria.";
  if($this->isAjax()) $this->load->view('vista_ajax_missatges',$dades);
  else $this->load->view('vista_bancdetemps', $dades);

Thank you for your time and congratullations to Ellislab for this great product (double great being open source).

Messages In This Thread
Problem with $anchor_class with Pagination class - by El Forum - 12-15-2011, 01:17 PM

Theme © iAndrew 2016 - Forum software by © MyBB