Welcome Guest, Not a member yet? Register   Sign In
Paginiation Links not showing up?
#1

[eluser]DesignBroJordan[/eluser]
Did a little looking through the search and can't find anyone with a similar problem to mine.

I'm following the pagination tut on nettuts by Jeff Way here...

http://net.tutsplus.com/articles/news/co...agination/

And I've got up to the point of initiating the pagination library in my controller and echoing out the links. However, I am not getting the links to display and from what I can see there are no errors at all. Here is my code...

Controller

Code:
<?php

class Site extends CI_Controller {
    
    function index()
    {
        $this->load->library('pagination');
        
        $config['base_url'] = 'http://localhost/CI_Day6/index.php/site/index';
        $config['total_rows'] = $this->db->get('data')->num_rows();
        $config['per_page'] = 10;
        $config['num_links'] = 20;
        
        $this->pagination->initialize($config);
        
        $data['records'] = $this->db->get('data', $config['per_page'], $this->uri->segment(3));
        
        $this->load->view('site_view', $data);
    }
}

And my view code...

Code:
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset-utf-8">
        <title>untitled</title>
</head>
<body>
    <div id="container">
        <h1>Super Pagination With CodeIgniter</h1>
        
        &lt;?php echo $this->pagination->create_links(); ?&gt;
    </div>
&lt;/body&gt;
&lt;/html&gt;

I'm about to head to a super bowl party and don't have a whole lot of time to sit here and stare at it to try to find it.

The only think displaying on the page is the heading.

Any guidance will much appreciated!
#2

[eluser]Unknown[/eluser]
What does the query "$this->db->get('data')->num_rows();" return?

If it returns 0, create_links() won't display anything.
#3

[eluser]DesignBroJordan[/eluser]
well I have just 10 random entries in the database, and the table is called data, I can double check my database config file to make sure that the right database is being called
#4

[eluser]cideveloper[/eluser]
Quote:well I have just 10 random entries in the database
If you have 10 rows in your table and $config['per_page'] = 10 all the records are being showed thus no need for pagination links to show up. What are you going to paginate to.
#5

[eluser]DesignBroJordan[/eluser]
ah I see your point, did I mention I'm extremely dumb when it comes to php, lol thank you for your assistance, I will try to not screw anything up from here on out but we'll see




Theme © iAndrew 2016 - Forum software by © MyBB