Welcome Guest, Not a member yet? Register   Sign In
Pagination Display Only 10 Links Records And Last Link Record
#1

[eluser]Ahmed Iqbal[/eluser]
Hello Friends,
im using codeingiter 1.7.2 version. i've problem with my site pagination. im trying to explain you with code. problem is that, my pagination working but still first link [1] selected. i mean when i click on [2], so pagination need to be select 2. but here only one selected in every where.
second problem, im show 10 links in pagination. so, only 10 link's records display. [last] link display last 10 records. im unable to see central records link pagination. for example im on link [10]. so i'll get more [11] to [20] records link. but my pagination consist on 10 link and last link.
Please, suggest me how i fix my code. to display proper full pagination....! waiting for reply...! thanks

Model Code:
Code:
function cat_get_sms($num, $offset) {
    $this->db->select('cat_id');
    $this->db->from('categories');
    $this->db->where('cat_name', $cat);
    $this->db->limit(1);
    $cat_result = $this->db->get();
    $cat_result = $cat_result->row();
    $catid = $cat_result->cat_id;
    
    $this->db->from('sms');
    $this->db->join('users','sms.user_id = users.user_id');
    $this->db->join('categories','sms.cat_id = categories.cat_id');
    $this->db->where('sms.cat_id',$catid);
    $this->db->order_by('sms.sms_added_date', 'desc');
    $this->db->limit($num, $offset);
    $query = $this->db->get();
        
        if ($query->num_rows > 0) {
            foreach ($query->result() as $row)
            $data[] = $row;
        }
        return $data;
    }

Controller Code:
Code:
function categorie() {
    $this->load->model('database');
    
    $this->load->library('pagination');
    $this->load->helper('url');
    $config['base_url']         = base_url() . $this->uri->segment(3);
    $config['total_rows']         = $this->database->cat_total_sms();
    $config['per_page']         = '10';
    $config['num_links']         = '10';
    $config['full_tag_open']     = '<div id="pagination">';
    $config['full_tag_close'] = '</div>';
    $this->pagination->initialize($config);
    
    $data['categories'] = $this->database->get_cat();
    $data['count_cat']  = $this->database->count_cat();
    $data['sms']           = $this->database->cat_get_sms($config['per_page'], $this->uri->segment(4));
    $data['count_sms']  = $this->database->count_sms();
    //$data['pagination']  = $this->pagination->create_links();
    
    $this->load->view('categorie_view', $data);
}

View Code:
Code:
&lt;?php echo $this->pagination->create_links(); ?&gt;
#2

[eluser]Fireclave[/eluser]
Hi, i have this problem too.

The pagination class is sometime working great an sometime horror.

I don't know why, too....
#3

[eluser]Ahmed Iqbal[/eluser]
Please, anybody have idea about this?
#4

[eluser]Fireclave[/eluser]
you could an other Query and look again
#5

[eluser]Ahmed Iqbal[/eluser]
i've used custom pagination its working fine for me...! codeigniter pagination not perfect....!
#6

[eluser]Fireclave[/eluser]
do you have a link to this library ?

i would change too !!!
#7

[eluser]Ahmed Iqbal[/eluser]
check your PM.




Theme © iAndrew 2016 - Forum software by © MyBB