Welcome Guest, Not a member yet? Register   Sign In
Pagination help - missing back link on pages above 1
#1

[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. =/
#2

[eluser]jasont[/eluser]
no takers?
#3

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

try To Put in View dont in Controller
#4

[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.
#5

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

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

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

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

[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
#9

[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.
#10

[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




Theme © iAndrew 2016 - Forum software by © MyBB