ifly 发表于 2012-11-15 11:46:13

急急问,分页链接死活不显示。

      根据类别分页,但是分页死活不显示,不知道啥原因。各位高手帮看看哪里有问题。
      
      //建立分页
      if($this->uri->segment(3)){
            $catid = $this->uri->segment(3);
      } else {
            $catid = 0;
      }
      
      if($this->uri->segment(4)){
            $offset = $this->uri->segment(4);
      } else {
            $offset = 0;
      }
      
      $this->load->library('pagination');
      $config['base_url'] = site_url('welcome/index'.$catid);
      $config['per_page'] = 2;
      $config['uri_segment'] = 4;
      $config['full_tag_open'] = '<p>';
      $config['full_tag_close'] = '</p>';
      $config['first_link'] = '首页';
      $config['last_link'] = '尾页';
      $config['total_row'] = $this->MProducts->getCountByCategory($catid);   //按类别达到产品数量      
      $this->pagination->initialize($config);
      $data['page_links'] = $this->pagination->create_links();
      
      var_dump($data['page_links']);   //这个里面没任何信息,不知道啥原因
      
          //根据类别获取数据
      
      if($catid > 0) {
            $data['products'] = $this->MProducts->getProductsByCategory($catid,$config['per_page'],$offset);
      } else {
            $data['products'] = $this->MProducts->getAllProducts();
      }
      
      $this->load->vars($data);
      $this->load->view('home');

ifly 发表于 2012-11-15 15:42:16

疯掉了。。。
解决了 $config['total_row'] = $this->MProducts->getCountByCategory($catid);
          total_rows 少写了个 s
页: [1]
查看完整版本: 急急问,分页链接死活不显示。