Welcome Guest, Not a member yet? Register   Sign In
Pagination next prev doesn't work correctly.
#1

[eluser]Unknown[/eluser]
Hi everybody! I'm new on this forum. Smile

I have a problem with my pagination "next, prev".

At first my pagination code:

Code:
public function news($id)
    {  
        $config['base_url'] = 'http://localhost/codei/index.php/informatyka/news';
        $config['total_rows'] = $this->news_model->countDirectionCategoryNews('Informatyka_news', 'Informatyka', 'Aktualności') // return 10;
        $config['per_page'] = 1;
        $config['display_pages'] = false;
        $config['first_link'] = FALSE;
        $config['last_link'] = FALSE;
        $config['next_link'] = 'Następny';
        $config['prev_link'] = 'Poprzedni';

        $this->pagination->initialize($config);
        
        $data['singleNews'] = $this->news_model->getSingleNews('Informatyka_news', 'Informatyka', 'Aktualności', $id);
        
        $this->load->view('kierunki/informatyka/pojedynczy', $data);
    }

On my view I just added "create_links".

Pagination works, but not correctly. I have 10 news on my database and for example if I go to page with id 7 I see links "prev, next", so it's ok, but if I go to news with id 1 (..index.php/informatyka/news/1), I'm still see a link 'prev'. If I click it, I get the error "Missing argument 1 for Informatyka::news()" Why I see "prev" link on my first news and how I can get rid of it? It should no be, right?

Next, if I go to last "next" link, I see news width id 9 (..index.php/informatyka/news/9), but I have 10, button "next" disappeared. If I write manually in the browser id 10, it's works.

Can anybody help me, please?




Theme © iAndrew 2016 - Forum software by © MyBB