Welcome Guest, Not a member yet? Register   Sign In
Category/View/Id/Pageno question ?
#1

[eluser]By AzraiL[/eluser]
Hello friends,
ı am category/view/id/pageno i tried to make the system will help you unfortunately did not do this?
my category model
Code:
function kategori_goster_site()
    {
        $this->load->library('pagination');
        $per_page = 1;        
        $this->db->select('icerikler.*, kategoriler.*', FALSE);
        $this->db->join('kategoriler','icerikler.katid = kategoriler.id');
        $this->db->order_by('icerikler.id', 'ASC');
        
        $total     = $this->db->get_where('icerikler', array('icerikler.katid' => $this->uri->segment(3)));
        $total_row = $this->db->get_where('icerikler', array('icerikler.katid' => $this->uri->segment(3)));
                
        $config['base_url'] = base_url().'/kategori/goster/';
        $config['total_rows'] = $total_row->num_rows();
        $config['per_page'] = $per_page;
        $config['prev_link'] = '< Önceki |';
        $config['next_link'] = '| Sonraki >';
        $config['num_links'] = 6;
        $this->pagination->initialize($config);
                
        $query = $total;
        return $query->result();
    }

I would do this but unfortunately the page is the button does not work :-S
#2

[eluser]TheFuzzy0ne[/eluser]
The problem is that your total rows needs to be the total rows in your database for that particular item. You have supplied the total rows in the result set, not the database. It would pay to actually count the rows rather than try to return them:
Code:
$this->db->where(array('icerikler.katid' => $this->uri->segment(3)));
$total_row = $this->db->count_all_results('icerikler');
#3

[eluser]By AzraiL[/eluser]
normally part
Code:
$total_row = $this->db->get_where('icerikler', array('icerikler.katid' => $this->uri->segment(3)));
to use as a paging is working but I want to do, an event such as view/1/pageno = 1
#4

[eluser]TheFuzzy0ne[/eluser]
That method actually returns the rows, but you only need the count since the rows are already returned by your first query. It might also pay to set the URI segment manually, too. This tutorial may help you - http://godbit.com/article/pagination-with-code-igniter.




Theme © iAndrew 2016 - Forum software by © MyBB