Welcome Guest, Not a member yet? Register   Sign In
Pagination does not show pages links.
#1

[eluser]Unknown[/eluser]
Hello,

Im having problems with pagination to work right. The adressing works fine but cant force the pagination links to display

Here is the controller
Code:
public function listing(){
        $data['content']='contentList';
        $data['row']="";

        $config['per_page'] = 10;
        $config['num_links'] = 5;
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';

        if($this->uri->segment(2)!=""){
            $this->load->model('datamodel');
            $data['row']=$this->datamodel->getByOs($this->uri->segment(2), $config['per_page'],$this->uri->segment(3));
            $config['base_url'] = base_url().'list/'.$this->uri->segment(2);
        }
        /*
        if($this->uri->segment(2)!="" && $this->uri->segment(3)!=""){
            $this->load->model('datamodel');
            $data['row']=$this->datamodel->getByCat($this->uri->segment(2), $this->uri->segment(3));
            $config['base_url'] = base_url().'list/'.$this->uri->segment(2).'/'.$this->uri->segment(3);
        }
        if($this->uri->segment(2)!="" && $this->uri->segment(3)!="" && $this->uri->segment(4)!=""){
            $this->load->model('datamodel');
            $data['row']=$this->datamodel->getBySubCat($this->uri->segment(2), $this->uri->segment(3), $this->uri->segment(4));
            $config['base_url'] = base_url().'list/'.$this->uri->segment(2).'/'.$this->uri->segment(3).'/'.$this->uri->segment(4);
        }
        */
        $config['total_rows'] = count($data['row']);

        $this->pagination->initialize($config);
        
        $this->load->view('main', $data);
            
    }

Here is model
Code:
public function getByOs($os, $num, $offset){
            //$q = $this->db->query("SELECT * FROM programs WHERE osForDb='".$os."'");

            $q = $this->db->get_where('programs', array('osForDb' => $os), $num, $offset);
            
            if($q->num_rows()>0){
                foreach($q->result() as $row){
                    $data[]=$row;
                }
                return $data;
            }

        }

and here is the view
Code:
if(!empty($row)){
        foreach($row as $r){
            echo $r->name."<br/>";
        }
    }
    
    echo $this->pagination->create_links();

Im rly newbie to codeigniter yet, guess its some totally dumb thing. Thx for help in advance.


Messages In This Thread
Pagination does not show pages links. - by El Forum - 02-03-2012, 08:11 PM
Pagination does not show pages links. - by El Forum - 02-06-2012, 03:59 AM
Pagination does not show pages links. - by El Forum - 04-18-2012, 07:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB