CodeIgniter Forums

Full Version: Pagination help - missing back link on pages above 1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]jasont[/eluser]
Pagination seems to be working however after clicking page 2, you see page 2 and the pagination links show the same page with no link back to page 1.

Any ideas?

(I'm using uri segment 4 due to using folders)

here's the code used

Code:
// blog - Controller
    function index()
    {

        $data['title'] = "My Real Title";
        $data['heading'] = "My Real Heading";
        $data['year'] = date('Y');
        
        $this->load->model('blog/Blogmodel');

        // Build Pagination
        $this->load->library('pagination');
        $config['base_url'] = base_url().'index.php/blog/blog/index/';
        $config['total_rows'] = $this->db->count_all('posts');
        $config['per_page'] = '2';
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        
        $this->pagination->initialize($config);
        
        $data['paging_links'] = $this->pagination->create_links();
        
        // Get DB Data
        $data['query'] = $this->Blogmodel->get_last_ten_entries($config['per_page'],$this->uri->segment(4));
        
        // Output
        $this->load->view('blog/blog_header', $data);
        $this->load->view('blog/blogview', $data);
        $this->load->view('blog/blog_footer', $data);
    }

Code:
// blogview - View
<h1>&lt;?php echo $heading;?&gt;</h1>
    
<h3>Posts</h3>    

<ul>
&lt;?php foreach($query as $item):?&gt;

<li>&lt;?php echo $item->title;?&gt;</li>

&lt;?php endforeach;?&gt;
</ul>
    
&lt;?php echo $paging_links; ?&gt;

Can't figure this one out. =/

El Forum

[eluser]jasont[/eluser]
no takers?

El Forum

[eluser]mamen[/eluser]
<code>echo $this->pagination->create_links();</code>

try To Put in View dont in Controller

El Forum

[eluser]kocet[/eluser]
i have same problem with you, i can see the page number but pagination doesn't work properly. i put the controller in sub folder.

El Forum

[eluser]Thorpe Obazee[/eluser]
Try adding this to you config

Code:
$config['uri_segment'] = 4;

El Forum

[eluser]kocet[/eluser]
thank's Chamyto. Problem solved.

El Forum

[eluser]Thorpe Obazee[/eluser]
My pleasure :p

El Forum

[eluser]jasont[/eluser]
Still doesn't work.

The pagination always shows page 1.
in the browser URL, if I type 2, 3, 4 etc, it loads those pages but the pagination always shows that we are on page 1.

Weird

El Forum

[eluser]Unknown[/eluser]
[quote author="bargainph" date="1236602273"]Try adding this to you config

Code:
$config['uri_segment'] = 4;
[/quote]



Thanx It solved my problem.

El Forum

[eluser]Thorpe Obazee[/eluser]
[quote author="Bhoot pe Bhoot" date="1244642103"][quote author="bargainph" date="1236602273"]Try adding this to you config

Code:
$config['uri_segment'] = 4;
[/quote]



Thanx It solved my problem.[/quote]

no problem Tongue