Link separator CodeIgniter

435 Views Asked by At

It's easy for who know

In this code:

$maximo = 12;
    $inicio = (!$this->uri->segment(3)) ? 0 : $this->uri->segment(3);
    $config['base_url'] = 'clientes/index/';
    $config['total_rows'] = $this->clientes_items_m->count_all();
    $config['per_page'] = $maximo;
    $config['next_link'] = '>';
    $config['prev_link'] = '<';
    $config['cur_tag_open'] = '<li><a><b>';
    $config['cur_tag_close'] = '</b></a></li>';
    $this->pagination->initialize($config);
    $pagination = $this->pagination->create_links();

    //Busca no banco as noticias
    $items = $this->clientes_items_m->limit($maximo,$inicio)->get_all();

i want put separator like this( <span id="divider">/</span> ) between link of page but i don't know how to do that. anybody help me??

3

There are 3 best solutions below

1
On

Try it like this

$config['cur_tag_open'] = '<li><a><b>';
$config['cur_tag_close'] = '</b></a></li><span id="divider">/</span>';
4
On

See if this works...

In your pagination code:

$config['num_tag_open'] = '<span class="divider">';
$config['num_tag_close'] = '/</span>';

Or you could leave the forward slash out of that code, and use CSS:

span.divider::after {
  content: "/";
}

By the way, and a bit off topic, but you're going to have multiple of these divider slashes, so instead of giving them an id, you should use a class (.divider).

0
On

You can use this Generic Pagination Class. I dont know if CI pagination class supports seperating the links? I found out about his class here.

Here is an example how to use from the link above:

// Load the library
$this->load->library('paginate');

// Setup config array
$config = array(
        'total_items' => 100,
        'items_per_page' => 20,
        'current_page' => 1,
        'page_link_separator' => '&bull;'
    );

// Pass in config array to library
$this->paginate->configure($config);

// Get the pagination array
$this->data['pages'] = $this->paginate->get(); 

You should be able to easily replace &bull with any separator you like.

Hope this helps.